Browse Source

Upgrade V8 to 3.1.8.3

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
53dc74e12f
  1. 8
      deps/v8/src/arm/codegen-arm.cc
  2. 2
      deps/v8/src/arm/debug-arm.cc
  3. 30
      deps/v8/src/parser.cc
  4. 4
      deps/v8/src/parser.h
  5. 29
      deps/v8/src/scopes.cc
  6. 18
      deps/v8/src/scopes.h
  7. 2
      deps/v8/src/version.cc
  8. 8
      deps/v8/test/mjsunit/bitops-info.js

8
deps/v8/src/arm/codegen-arm.cc

@ -1153,7 +1153,7 @@ void DeferredInlineSmiOperation::GenerateNonSmiInput() {
} }
// Check that the *signed* result fits in a smi. Not necessary for AND, SAR // Check that the *signed* result fits in a smi. Not necessary for AND, SAR
// if the shift if more than 0 or SHR if the shit is more than 1. // if the shift if more than 0 or SHR if the shit is more than 1.
if (!( (op_ == Token::AND) || if (!( (op_ == Token::AND && value_ >= 0) ||
((op_ == Token::SAR) && (shift_value > 0)) || ((op_ == Token::SAR) && (shift_value > 0)) ||
((op_ == Token::SHR) && (shift_value > 1)))) { ((op_ == Token::SHR) && (shift_value > 1)))) {
__ add(r3, int32, Operand(0x40000000), SetCC); __ add(r3, int32, Operand(0x40000000), SetCC);
@ -1414,8 +1414,10 @@ void CodeGenerator::SmiOperation(Token::Value op,
default: UNREACHABLE(); default: UNREACHABLE();
} }
deferred->BindExit(); deferred->BindExit();
TypeInfo result_type = TypeInfo result_type = TypeInfo::Integer32();
(op == Token::BIT_AND) ? TypeInfo::Smi() : TypeInfo::Integer32(); if (op == Token::BIT_AND && int_value >= 0) {
result_type = TypeInfo::Smi();
}
frame_->EmitPush(tos, result_type); frame_->EmitPush(tos, result_type);
} }
break; break;

2
deps/v8/src/arm/debug-arm.cc

@ -115,7 +115,7 @@ void BreakLocationIterator::SetDebugBreakAtSlot() {
patcher.masm()->mov(v8::internal::lr, v8::internal::pc); patcher.masm()->mov(v8::internal::lr, v8::internal::pc);
patcher.masm()->ldr(v8::internal::pc, MemOperand(v8::internal::pc, -4)); patcher.masm()->ldr(v8::internal::pc, MemOperand(v8::internal::pc, -4));
#endif #endif
patcher.Emit(Debug::debug_break_return()->entry()); patcher.Emit(Debug::debug_break_slot()->entry());
} }

30
deps/v8/src/parser.cc

@ -703,38 +703,40 @@ FunctionLiteral* Parser::DoParseProgram(Handle<String> source,
return result; return result;
} }
FunctionLiteral* Parser::ParseLazy(Handle<SharedFunctionInfo> info) { FunctionLiteral* Parser::ParseLazy(CompilationInfo* info) {
CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT); CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT);
HistogramTimerScope timer(&Counters::parse_lazy); HistogramTimerScope timer(&Counters::parse_lazy);
Handle<String> source(String::cast(script_->source())); Handle<String> source(String::cast(script_->source()));
Counters::total_parse_size.Increment(source->length()); Counters::total_parse_size.Increment(source->length());
Handle<SharedFunctionInfo> shared_info = info->shared_info();
// Initialize parser state. // Initialize parser state.
source->TryFlatten(); source->TryFlatten();
if (source->IsExternalTwoByteString()) { if (source->IsExternalTwoByteString()) {
ExternalTwoByteStringUC16CharacterStream stream( ExternalTwoByteStringUC16CharacterStream stream(
Handle<ExternalTwoByteString>::cast(source), Handle<ExternalTwoByteString>::cast(source),
info->start_position(), shared_info->start_position(),
info->end_position()); shared_info->end_position());
FunctionLiteral* result = ParseLazy(info, &stream, &zone_scope); FunctionLiteral* result = ParseLazy(info, &stream, &zone_scope);
return result; return result;
} else { } else {
GenericStringUC16CharacterStream stream(source, GenericStringUC16CharacterStream stream(source,
info->start_position(), shared_info->start_position(),
info->end_position()); shared_info->end_position());
FunctionLiteral* result = ParseLazy(info, &stream, &zone_scope); FunctionLiteral* result = ParseLazy(info, &stream, &zone_scope);
return result; return result;
} }
} }
FunctionLiteral* Parser::ParseLazy(Handle<SharedFunctionInfo> info, FunctionLiteral* Parser::ParseLazy(CompilationInfo* info,
UC16CharacterStream* source, UC16CharacterStream* source,
ZoneScope* zone_scope) { ZoneScope* zone_scope) {
Handle<SharedFunctionInfo> shared_info = info->shared_info();
scanner_.Initialize(source); scanner_.Initialize(source);
ASSERT(target_stack_ == NULL); ASSERT(target_stack_ == NULL);
Handle<String> name(String::cast(info->name())); Handle<String> name(String::cast(shared_info->name()));
fni_ = new FuncNameInferrer(); fni_ = new FuncNameInferrer();
fni_->PushEnclosingName(name); fni_->PushEnclosingName(name);
@ -746,18 +748,20 @@ FunctionLiteral* Parser::ParseLazy(Handle<SharedFunctionInfo> info,
{ {
// Parse the function literal. // Parse the function literal.
Handle<String> no_name = Factory::empty_symbol(); Handle<String> no_name = Factory::empty_symbol();
Scope* scope = Scope* scope = NewScope(top_scope_, Scope::GLOBAL_SCOPE, inside_with());
NewScope(top_scope_, Scope::GLOBAL_SCOPE, inside_with()); if (!info->closure().is_null()) {
scope = Scope::DeserializeScopeChain(info, scope);
}
LexicalScope lexical_scope(&this->top_scope_, &this->with_nesting_level_, LexicalScope lexical_scope(&this->top_scope_, &this->with_nesting_level_,
scope); scope);
TemporaryScope temp_scope(&this->temp_scope_); TemporaryScope temp_scope(&this->temp_scope_);
if (info->strict_mode()) { if (shared_info->strict_mode()) {
temp_scope.EnableStrictMode(); temp_scope.EnableStrictMode();
} }
FunctionLiteralType type = FunctionLiteralType type =
info->is_expression() ? EXPRESSION : DECLARATION; shared_info->is_expression() ? EXPRESSION : DECLARATION;
bool ok = true; bool ok = true;
result = ParseFunctionLiteral(name, result = ParseFunctionLiteral(name,
false, // Strict mode name already checked. false, // Strict mode name already checked.
@ -775,7 +779,7 @@ FunctionLiteral* Parser::ParseLazy(Handle<SharedFunctionInfo> info,
zone_scope->DeleteOnExit(); zone_scope->DeleteOnExit();
if (stack_overflow_) Top::StackOverflow(); if (stack_overflow_) Top::StackOverflow();
} else { } else {
Handle<String> inferred_name(info->inferred_name()); Handle<String> inferred_name(shared_info->inferred_name());
result->set_inferred_name(inferred_name); result->set_inferred_name(inferred_name);
} }
return result; return result;
@ -5133,7 +5137,7 @@ bool ParserApi::Parse(CompilationInfo* info) {
Handle<Script> script = info->script(); Handle<Script> script = info->script();
if (info->is_lazy()) { if (info->is_lazy()) {
Parser parser(script, true, NULL, NULL); Parser parser(script, true, NULL, NULL);
result = parser.ParseLazy(info->shared_info()); result = parser.ParseLazy(info);
} else { } else {
bool allow_natives_syntax = bool allow_natives_syntax =
FLAG_allow_natives_syntax || Bootstrapper::IsActive(); FLAG_allow_natives_syntax || Bootstrapper::IsActive();

4
deps/v8/src/parser.h

@ -426,7 +426,7 @@ class Parser {
bool in_global_context, bool in_global_context,
StrictModeFlag strict_mode); StrictModeFlag strict_mode);
FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info); FunctionLiteral* ParseLazy(CompilationInfo* info);
void ReportMessageAt(Scanner::Location loc, void ReportMessageAt(Scanner::Location loc,
const char* message, const char* message,
@ -441,7 +441,7 @@ class Parser {
// construct a hashable id, so if more than 2^17 are allowed, this // construct a hashable id, so if more than 2^17 are allowed, this
// should be checked. // should be checked.
static const int kMaxNumFunctionParameters = 32766; static const int kMaxNumFunctionParameters = 32766;
FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info, FunctionLiteral* ParseLazy(CompilationInfo* info,
UC16CharacterStream* source, UC16CharacterStream* source,
ZoneScope* zone_scope); ZoneScope* zone_scope);
enum Mode { enum Mode {

29
deps/v8/src/scopes.cc

@ -148,13 +148,14 @@ Scope::Scope(Scope* inner_scope, SerializedScopeInfo* scope_info)
unresolved_(16), unresolved_(16),
decls_(4) { decls_(4) {
ASSERT(scope_info != NULL); ASSERT(scope_info != NULL);
SetDefaults(FUNCTION_SCOPE, inner_scope->outer_scope(), scope_info); SetDefaults(FUNCTION_SCOPE, NULL, scope_info);
ASSERT(resolved()); ASSERT(resolved());
InsertAfterScope(inner_scope);
if (scope_info->HasHeapAllocatedLocals()) { if (scope_info->HasHeapAllocatedLocals()) {
num_heap_slots_ = scope_info_->NumberOfContextSlots(); num_heap_slots_ = scope_info_->NumberOfContextSlots();
} }
AddInnerScope(inner_scope);
// This scope's arguments shadow (if present) is context-allocated if an inner // This scope's arguments shadow (if present) is context-allocated if an inner
// scope accesses this one's parameters. Allocate the arguments_shadow_ // scope accesses this one's parameters. Allocate the arguments_shadow_
// variable if necessary. // variable if necessary.
@ -175,29 +176,39 @@ Scope::Scope(Scope* inner_scope, SerializedScopeInfo* scope_info)
} }
Scope* Scope::DeserializeScopeChain(CompilationInfo* info,
bool Scope::Analyze(CompilationInfo* info) { Scope* global_scope) {
ASSERT(info->function() != NULL); ASSERT(!info->closure().is_null());
Scope* top = info->function()->scope();
// If we have a serialized scope info, reuse it. // If we have a serialized scope info, reuse it.
if (!info->closure().is_null()) { Scope* innermost_scope = NULL;
Scope* scope = NULL;
SerializedScopeInfo* scope_info = info->closure()->shared()->scope_info(); SerializedScopeInfo* scope_info = info->closure()->shared()->scope_info();
if (scope_info != SerializedScopeInfo::Empty()) { if (scope_info != SerializedScopeInfo::Empty()) {
Scope* scope = top;
JSFunction* current = *info->closure(); JSFunction* current = *info->closure();
do { do {
current = current->context()->closure(); current = current->context()->closure();
SerializedScopeInfo* scope_info = current->shared()->scope_info(); SerializedScopeInfo* scope_info = current->shared()->scope_info();
if (scope_info != SerializedScopeInfo::Empty()) { if (scope_info != SerializedScopeInfo::Empty()) {
scope = new Scope(scope, scope_info); scope = new Scope(scope, scope_info);
if (innermost_scope == NULL) innermost_scope = scope;
} else { } else {
ASSERT(current->context()->IsGlobalContext()); ASSERT(current->context()->IsGlobalContext());
} }
} while (!current->context()->IsGlobalContext()); } while (!current->context()->IsGlobalContext());
} }
global_scope->AddInnerScope(scope);
if (innermost_scope == NULL) innermost_scope = global_scope;
return innermost_scope;
} }
bool Scope::Analyze(CompilationInfo* info) {
ASSERT(info->function() != NULL);
Scope* top = info->function()->scope();
while (top->outer_scope() != NULL) top = top->outer_scope(); while (top->outer_scope() != NULL) top = top->outer_scope();
top->AllocateVariables(info->calling_context()); top->AllocateVariables(info->calling_context());

18
deps/v8/src/scopes.h

@ -104,6 +104,9 @@ class Scope: public ZoneObject {
// doesn't re-allocate variables repeatedly. // doesn't re-allocate variables repeatedly.
static bool Analyze(CompilationInfo* info); static bool Analyze(CompilationInfo* info);
static Scope* DeserializeScopeChain(CompilationInfo* info,
Scope* innermost_scope);
// The scope name is only used for printing/debugging. // The scope name is only used for printing/debugging.
void SetScopeName(Handle<String> scope_name) { scope_name_ = scope_name; } void SetScopeName(Handle<String> scope_name) { scope_name_ = scope_name; }
@ -313,14 +316,6 @@ class Scope: public ZoneObject {
explicit Scope(Type type); explicit Scope(Type type);
void InsertAfterScope(Scope* scope) {
inner_scopes_.Add(scope);
outer_scope_ = scope->outer_scope_;
outer_scope_->inner_scopes_.RemoveElement(scope);
outer_scope_->inner_scopes_.Add(this);
scope->outer_scope_ = this;
}
// Scope tree. // Scope tree.
Scope* outer_scope_; // the immediately enclosing outer scope, or NULL Scope* outer_scope_; // the immediately enclosing outer scope, or NULL
ZoneList<Scope*> inner_scopes_; // the immediately enclosed inner scopes ZoneList<Scope*> inner_scopes_; // the immediately enclosed inner scopes
@ -413,6 +408,13 @@ class Scope: public ZoneObject {
private: private:
Scope(Scope* inner_scope, SerializedScopeInfo* scope_info); Scope(Scope* inner_scope, SerializedScopeInfo* scope_info);
void AddInnerScope(Scope* inner_scope) {
if (inner_scope != NULL) {
inner_scopes_.Add(inner_scope);
inner_scope->outer_scope_ = this;
}
}
void SetDefaults(Type type, void SetDefaults(Type type,
Scope* outer_scope, Scope* outer_scope,
SerializedScopeInfo* scope_info) { SerializedScopeInfo* scope_info) {

2
deps/v8/src/version.cc

@ -35,7 +35,7 @@
#define MAJOR_VERSION 3 #define MAJOR_VERSION 3
#define MINOR_VERSION 1 #define MINOR_VERSION 1
#define BUILD_NUMBER 8 #define BUILD_NUMBER 8
#define PATCH_LEVEL 0 #define PATCH_LEVEL 3
#define CANDIDATE_VERSION false #define CANDIDATE_VERSION false
// Define SONAME to have the SCons build the put a specific SONAME into the // Define SONAME to have the SCons build the put a specific SONAME into the

8
deps/v8/test/mjsunit/bitops-info.js

@ -37,7 +37,6 @@ function hidden_int32() {
return 1600822924; // It's a signed Int32. return 1600822924; // It's a signed Int32.
} }
function f() { function f() {
var x = non_int32(); // Not a constant. var x = non_int32(); // Not a constant.
var y = hidden_smi(); // Not a constant. var y = hidden_smi(); // Not a constant.
@ -66,6 +65,13 @@ function f() {
assertEquals(46512102 & 2600822924, x & y, "10rev"); assertEquals(46512102 & 2600822924, x & y, "10rev");
assertEquals(1600822924 & 2600822924, x & z, "11rev"); assertEquals(1600822924 & 2600822924, x & z, "11rev");
assertEquals((46512102 & -0x20123456) | 1, (y & -0x20123456) | 1, "12");
assertEquals((1600822924 & -0x20123456) | 1, (z & -0x20123456) | 1, "13");
assertEquals((2600822924 & -0x20123456) | 1, (x & -0x20123456) | 1, "14");
assertEquals((46512102 & -0x20123456) | 1, (-0x20123456 & y) | 1, "12rev");
assertEquals((1600822924 & -0x20123456) | 1, (-0x20123456 & z) | 1, "13rev");
assertEquals((2600822924 & -0x20123456) | 1, (-0x20123456 & x) | 1, "14rev");
assertEquals(2600822924 & 2600822924, x & x, "xx"); assertEquals(2600822924 & 2600822924, x & x, "xx");
assertEquals(y, y & y, "yy"); assertEquals(y, y & y, "yy");
assertEquals(z, z & z, "zz"); assertEquals(z, z & z, "zz");

Loading…
Cancel
Save