From 6959a1d6d16164f40bbeb5f65faaf17028932054 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 29 Oct 2009 16:11:05 +0100 Subject: [PATCH] Upgrade v8 to 1.3.18 --- deps/v8/ChangeLog | 7 + deps/v8/src/api.h | 9 - deps/v8/src/arm/codegen-arm.cc | 18 +- deps/v8/src/arm/fast-codegen-arm.cc | 225 +++++++++----- deps/v8/src/arm/frames-arm.cc | 15 +- deps/v8/src/arm/frames-arm.h | 2 +- deps/v8/src/arm/macro-assembler-arm.cc | 19 +- deps/v8/src/arm/macro-assembler-arm.h | 8 +- deps/v8/src/assembler.cc | 25 -- deps/v8/src/assembler.h | 8 - deps/v8/src/ast.h | 2 +- deps/v8/src/code-stubs.cc | 48 +-- deps/v8/src/code-stubs.h | 7 - deps/v8/src/codegen.cc | 16 - deps/v8/src/codegen.h | 28 +- deps/v8/src/compiler.cc | 32 +- deps/v8/src/fast-codegen.cc | 28 +- deps/v8/src/fast-codegen.h | 5 +- deps/v8/src/frames.cc | 18 +- deps/v8/src/frames.h | 25 +- deps/v8/src/globals.h | 4 - deps/v8/src/handles.cc | 15 - deps/v8/src/handles.h | 10 +- deps/v8/src/ia32/codegen-ia32.cc | 91 +----- deps/v8/src/ia32/fast-codegen-ia32.cc | 224 +++++++++----- deps/v8/src/ia32/frames-ia32.cc | 13 +- deps/v8/src/ia32/frames-ia32.h | 2 +- deps/v8/src/ia32/macro-assembler-ia32.cc | 96 +----- deps/v8/src/ia32/macro-assembler-ia32.h | 16 +- deps/v8/src/ia32/stub-cache-ia32.cc | 39 +-- deps/v8/src/location.h | 19 +- deps/v8/src/objects-debug.cc | 1 - deps/v8/src/objects-inl.h | 1 - deps/v8/src/objects.h | 4 +- deps/v8/src/runtime.cc | 64 +--- deps/v8/src/runtime.h | 3 - deps/v8/src/string.js | 9 +- deps/v8/src/stub-cache.cc | 7 +- deps/v8/src/top.h | 4 - deps/v8/src/version.cc | 2 +- deps/v8/src/x64/codegen-x64.cc | 23 +- deps/v8/src/x64/fast-codegen-x64.cc | 226 +++++++++----- deps/v8/src/x64/frames-x64.cc | 14 +- deps/v8/src/x64/frames-x64.h | 2 +- deps/v8/src/x64/macro-assembler-x64.cc | 19 +- deps/v8/src/x64/macro-assembler-x64.h | 8 +- deps/v8/test/cctest/SConscript | 1 - deps/v8/test/cctest/cctest.cc | 3 - deps/v8/test/cctest/cctest.h | 136 --------- deps/v8/test/cctest/test-accessors.cc | 424 --------------------------- deps/v8/test/cctest/test-api.cc | 352 +++++++++++++++++++++- deps/v8/test/cctest/test-debug.cc | 6 + deps/v8/test/cctest/test-log-stack-tracer.cc | 5 + deps/v8/test/mjsunit/fuzz-natives.js | 4 +- 54 files changed, 1022 insertions(+), 1370 deletions(-) delete mode 100644 deps/v8/test/cctest/test-accessors.cc diff --git a/deps/v8/ChangeLog b/deps/v8/ChangeLog index e816f58..8ee8376 100644 --- a/deps/v8/ChangeLog +++ b/deps/v8/ChangeLog @@ -1,3 +1,10 @@ +2009-10-29: Version 1.3.18 + + Reverted a change which caused crashes in RegExp replace. + + Reverted a change which caused Chromium ui_tests failure. + + 2009-10-28: Version 1.3.17 Added API method to get simple heap statistics. diff --git a/deps/v8/src/api.h b/deps/v8/src/api.h index a28e1f0..1221f35 100644 --- a/deps/v8/src/api.h +++ b/deps/v8/src/api.h @@ -125,15 +125,6 @@ static inline v8::internal::Handle FromCData(T obj) { } -class ApiFunction { - public: - explicit ApiFunction(v8::internal::Address addr) : addr_(addr) { } - v8::internal::Address address() { return addr_; } - private: - v8::internal::Address addr_; -}; - - v8::Arguments::Arguments(v8::Local data, v8::Local holder, v8::Local callee, diff --git a/deps/v8/src/arm/codegen-arm.cc b/deps/v8/src/arm/codegen-arm.cc index 3292bdc..dd88515 100644 --- a/deps/v8/src/arm/codegen-arm.cc +++ b/deps/v8/src/arm/codegen-arm.cc @@ -5795,7 +5795,7 @@ void CEntryStub::GenerateCore(MacroAssembler* masm, Label* throw_normal_exception, Label* throw_termination_exception, Label* throw_out_of_memory_exception, - ExitFrame::Mode mode, + StackFrame::Type frame_type, bool do_gc, bool always_allocate) { // r0: result parameter for PerformGC, if any @@ -5855,7 +5855,7 @@ void CEntryStub::GenerateCore(MacroAssembler* masm, // r0:r1: result // sp: stack pointer // fp: frame pointer - __ LeaveExitFrame(mode); + __ LeaveExitFrame(frame_type); // check if we should retry or throw exception Label retry; @@ -5901,12 +5901,12 @@ void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) { // this by performing a garbage collection and retrying the // builtin once. - ExitFrame::Mode mode = is_debug_break - ? ExitFrame::MODE_DEBUG - : ExitFrame::MODE_NORMAL; + StackFrame::Type frame_type = is_debug_break + ? StackFrame::EXIT_DEBUG + : StackFrame::EXIT; // Enter the exit frame that transitions from JavaScript to C++. - __ EnterExitFrame(mode); + __ EnterExitFrame(frame_type); // r4: number of arguments (C callee-saved) // r5: pointer to builtin function (C callee-saved) @@ -5921,7 +5921,7 @@ void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) { &throw_normal_exception, &throw_termination_exception, &throw_out_of_memory_exception, - mode, + frame_type, false, false); @@ -5930,7 +5930,7 @@ void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) { &throw_normal_exception, &throw_termination_exception, &throw_out_of_memory_exception, - mode, + frame_type, true, false); @@ -5941,7 +5941,7 @@ void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) { &throw_normal_exception, &throw_termination_exception, &throw_out_of_memory_exception, - mode, + frame_type, true, true); diff --git a/deps/v8/src/arm/fast-codegen-arm.cc b/deps/v8/src/arm/fast-codegen-arm.cc index 21ee6d7..6540d40 100644 --- a/deps/v8/src/arm/fast-codegen-arm.cc +++ b/deps/v8/src/arm/fast-codegen-arm.cc @@ -119,9 +119,11 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) { void FastCodeGenerator::Move(Location destination, Slot* source) { switch (destination.type()) { - case Location::NOWHERE: + case Location::kUninitialized: + UNREACHABLE(); + case Location::kEffect: break; - case Location::TEMP: + case Location::kValue: __ ldr(ip, MemOperand(fp, SlotOffset(source))); __ push(ip); break; @@ -131,9 +133,11 @@ void FastCodeGenerator::Move(Location destination, Slot* source) { void FastCodeGenerator::Move(Location destination, Literal* expr) { switch (destination.type()) { - case Location::NOWHERE: + case Location::kUninitialized: + UNREACHABLE(); + case Location::kEffect: break; - case Location::TEMP: + case Location::kValue: __ mov(ip, Operand(expr->handle())); __ push(ip); break; @@ -143,9 +147,10 @@ void FastCodeGenerator::Move(Location destination, Literal* expr) { void FastCodeGenerator::Move(Slot* destination, Location source) { switch (source.type()) { - case Location::NOWHERE: + case Location::kUninitialized: // Fall through. + case Location::kEffect: UNREACHABLE(); - case Location::TEMP: + case Location::kValue: __ pop(ip); __ str(ip, MemOperand(fp, SlotOffset(destination))); break; @@ -155,10 +160,12 @@ void FastCodeGenerator::Move(Slot* destination, Location source) { void FastCodeGenerator::DropAndMove(Location destination, Register source) { switch (destination.type()) { - case Location::NOWHERE: + case Location::kUninitialized: + UNREACHABLE(); + case Location::kEffect: __ pop(); break; - case Location::TEMP: + case Location::kValue: __ str(source, MemOperand(sp)); break; } @@ -239,6 +246,33 @@ void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) { } +void FastCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { + Comment cmnt(masm_, "[ RegExp Literal"); + Label done; + // Registers will be used as follows: + // r4 = JS function, literals array + // r3 = literal index + // r2 = RegExp pattern + // r1 = RegExp flags + // r0 = temp + return value (RegExp literal) + __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); + __ ldr(r4, FieldMemOperand(r0, JSFunction::kLiteralsOffset)); + int literal_offset = + FixedArray::kHeaderSize + expr->literal_index() * kPointerSize; + __ ldr(r0, FieldMemOperand(r4, literal_offset)); + __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); + __ cmp(r0, ip); + __ b(ne, &done); + __ mov(r3, Operand(Smi::FromInt(expr->literal_index()))); + __ mov(r2, Operand(expr->pattern())); + __ mov(r1, Operand(expr->flags())); + __ stm(db_w, sp, r4.bit() | r3.bit() | r2.bit() | r1.bit()); + __ CallRuntime(Runtime::kMaterializeRegExpLiteral, 4); + __ bind(&done); + Move(expr->location(), r0); +} + + void FastCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { Comment cmnt(masm_, "[ ObjectLiteral"); Label boilerplate_exists; @@ -284,73 +318,62 @@ void FastCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { result_saved = true; } switch (property->kind()) { - case ObjectLiteral::Property::MATERIALIZED_LITERAL: // fall through + case ObjectLiteral::Property::CONSTANT: + UNREACHABLE(); + + case ObjectLiteral::Property::MATERIALIZED_LITERAL: // Fall through. ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); - case ObjectLiteral::Property::COMPUTED: // fall through + case ObjectLiteral::Property::COMPUTED: + if (key->handle()->IsSymbol()) { + Visit(value); + Move(r0, value->location()); + __ mov(r2, Operand(key->handle())); + Handle ic(Builtins::builtin(Builtins::StoreIC_Initialize)); + __ Call(ic, RelocInfo::CODE_TARGET); + // StoreIC leaves the receiver on the stack. + break; + } + // Fall through. + case ObjectLiteral::Property::PROTOTYPE: __ push(r0); Visit(key); - ASSERT(key->location().is_temporary()); + ASSERT(key->location().is_value()); Visit(value); - ASSERT(value->location().is_temporary()); + ASSERT(value->location().is_value()); __ CallRuntime(Runtime::kSetProperty, 3); __ ldr(r0, MemOperand(sp)); // Restore result into r0 break; - case ObjectLiteral::Property::SETTER: // fall through - case ObjectLiteral::Property::GETTER: + + case ObjectLiteral::Property::GETTER: // Fall through. + case ObjectLiteral::Property::SETTER: __ push(r0); Visit(key); - ASSERT(key->location().is_temporary()); + ASSERT(key->location().is_value()); __ mov(r1, Operand(property->kind() == ObjectLiteral::Property::SETTER ? Smi::FromInt(1) : Smi::FromInt(0))); __ push(r1); Visit(value); - ASSERT(value->location().is_temporary()); + ASSERT(value->location().is_value()); __ CallRuntime(Runtime::kDefineAccessor, 4); __ ldr(r0, MemOperand(sp)); // Restore result into r0 break; - default: UNREACHABLE(); } } switch (expr->location().type()) { - case Location::NOWHERE: + case Location::kUninitialized: + UNREACHABLE(); + case Location::kEffect: if (result_saved) __ pop(); break; - case Location::TEMP: + case Location::kValue: if (!result_saved) __ push(r0); break; } } -void FastCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { - Comment cmnt(masm_, "[ RegExp Literal"); - Label done; - // Registers will be used as follows: - // r4 = JS function, literals array - // r3 = literal index - // r2 = RegExp pattern - // r1 = RegExp flags - // r0 = temp + return value (RegExp literal) - __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); - __ ldr(r4, FieldMemOperand(r0, JSFunction::kLiteralsOffset)); - int literal_offset = - FixedArray::kHeaderSize + expr->literal_index() * kPointerSize; - __ ldr(r0, FieldMemOperand(r4, literal_offset)); - __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); - __ cmp(r0, ip); - __ b(ne, &done); - __ mov(r3, Operand(Smi::FromInt(expr->literal_index()))); - __ mov(r2, Operand(expr->pattern())); - __ mov(r1, Operand(expr->flags())); - __ stm(db_w, sp, r4.bit() | r3.bit() | r2.bit() | r1.bit()); - __ CallRuntime(Runtime::kMaterializeRegExpLiteral, 4); - __ bind(&done); - Move(expr->location(), r0); -} - - void FastCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { Comment cmnt(masm_, "[ ArrayLiteral"); Label make_clone; @@ -400,7 +423,7 @@ void FastCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { result_saved = true; } Visit(subexpr); - ASSERT(subexpr->location().is_temporary()); + ASSERT(subexpr->location().is_value()); // Store the subexpression value in the array's elements. __ pop(r0); // Subexpression value. @@ -416,10 +439,12 @@ void FastCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { } switch (expr->location().type()) { - case Location::NOWHERE: + case Location::kUninitialized: + UNREACHABLE(); + case Location::kEffect: if (result_saved) __ pop(); break; - case Location::TEMP: + case Location::kValue: if (!result_saved) __ push(r0); break; } @@ -446,7 +471,7 @@ void FastCodeGenerator::VisitAssignment(Assignment* expr) { if (rhs->AsLiteral() != NULL) { __ mov(r0, Operand(rhs->AsLiteral()->handle())); } else { - ASSERT(rhs->location().is_temporary()); + ASSERT(rhs->location().is_value()); Visit(rhs); __ pop(r0); } @@ -468,15 +493,17 @@ void FastCodeGenerator::VisitAssignment(Assignment* expr) { __ str(ip, MemOperand(fp, SlotOffset(var->slot()))); Move(expr->location(), ip); } else { - ASSERT(rhs->location().is_temporary()); + ASSERT(rhs->location().is_value()); Visit(rhs); // Load right-hand side into ip. switch (expr->location().type()) { - case Location::NOWHERE: + case Location::kUninitialized: + UNREACHABLE(); + case Location::kEffect: // Case 'var = temp'. Discard right-hand-side temporary. __ pop(ip); break; - case Location::TEMP: + case Location::kValue: // Case 'temp1 <- (var = temp0)'. Preserve right-hand-side // temporary on the stack. __ ldr(ip, MemOperand(sp)); @@ -522,10 +549,12 @@ void FastCodeGenerator::VisitProperty(Property* expr) { __ pop(); } switch (expr->location().type()) { - case Location::TEMP: + case Location::kUninitialized: + UNREACHABLE(); + case Location::kValue: __ str(r0, MemOperand(sp)); break; - case Location::NOWHERE: + case Location::kEffect: __ pop(); } } @@ -546,7 +575,7 @@ void FastCodeGenerator::VisitCall(Call* expr) { int arg_count = args->length(); for (int i = 0; i < arg_count; i++) { Visit(args->at(i)); - ASSERT(args->at(i)->location().is_temporary()); + ASSERT(args->at(i)->location().is_value()); } // Record source position for debugger SetSourcePosition(expr->position()); @@ -567,7 +596,7 @@ void FastCodeGenerator::VisitCallNew(CallNew* node) { // arguments. // Push function on the stack. Visit(node->expression()); - ASSERT(node->expression()->location().is_temporary()); + ASSERT(node->expression()->location().is_value()); // Push global object (receiver). __ ldr(r0, CodeGenerator::GlobalObject()); @@ -577,8 +606,8 @@ void FastCodeGenerator::VisitCallNew(CallNew* node) { int arg_count = args->length(); for (int i = 0; i < arg_count; i++) { Visit(args->at(i)); - ASSERT(args->at(i)->location().is_temporary()); - // If location is temporary, it is already on the stack, + ASSERT(args->at(i)->location().is_value()); + // If location is value, it is already on the stack, // so nothing to do here. } @@ -610,7 +639,7 @@ void FastCodeGenerator::VisitCallRuntime(CallRuntime* expr) { int arg_count = args->length(); for (int i = 0; i < arg_count; i++) { Visit(args->at(i)); - ASSERT(args->at(i)->location().is_temporary()); + ASSERT(args->at(i)->location().is_value()); } __ CallRuntime(function, arg_count); @@ -619,11 +648,57 @@ void FastCodeGenerator::VisitCallRuntime(CallRuntime* expr) { void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { - // Compile a short-circuited boolean or operation in a non-test - // context. - ASSERT(expr->op() == Token::OR); + switch (expr->op()) { + case Token::COMMA: + ASSERT(expr->left()->location().is_effect()); + ASSERT_EQ(expr->right()->location().type(), expr->location().type()); + Visit(expr->left()); + Visit(expr->right()); + break; + + case Token::OR: + case Token::AND: + EmitLogicalOperation(expr); + break; + + case Token::ADD: + case Token::SUB: + case Token::DIV: + case Token::MOD: + case Token::MUL: + case Token::BIT_OR: + case Token::BIT_AND: + case Token::BIT_XOR: + case Token::SHL: + case Token::SHR: + case Token::SAR: { + ASSERT(expr->left()->location().is_value()); + ASSERT(expr->right()->location().is_value()); + + Visit(expr->left()); + Visit(expr->right()); + __ pop(r0); + __ pop(r1); + GenericBinaryOpStub stub(expr->op(), + NO_OVERWRITE); + __ CallStub(&stub); + Move(expr->location(), r0); + + break; + } + default: + UNREACHABLE(); + } +} + + +void FastCodeGenerator::EmitLogicalOperation(BinaryOperation* expr) { + // Compile a short-circuited boolean operation in a non-test context. + // Compile (e0 || e1) as if it were // (let (temp = e0) temp ? temp : e1). + // Compile (e0 && e1) as if it were + // (let (temp = e0) !temp ? temp : e1). Label done; Location destination = expr->location(); @@ -636,31 +711,31 @@ void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { if (left->AsLiteral() != NULL) { __ mov(r0, Operand(left->AsLiteral()->handle())); __ push(r0); - if (destination.is_temporary()) __ push(r0); + if (destination.is_value()) __ push(r0); } else { Visit(left); - ASSERT(left->location().is_temporary()); - if (destination.is_temporary()) { + ASSERT(left->location().is_value()); + if (destination.is_value()) { __ ldr(r0, MemOperand(sp)); __ push(r0); } } // The left-hand value is in on top of the stack. It is duplicated on the - // stack iff the destination location is temporary. + // stack iff the destination location is value. __ CallRuntime(Runtime::kToBool, 1); - __ LoadRoot(ip, Heap::kTrueValueRootIndex); + if (expr->op() == Token::OR) { + __ LoadRoot(ip, Heap::kTrueValueRootIndex); + } else { + __ LoadRoot(ip, Heap::kFalseValueRootIndex); + } __ cmp(r0, ip); __ b(eq, &done); // Discard the left-hand value if present on the stack. - if (destination.is_temporary()) __ pop(); + if (destination.is_value()) __ pop(); // Save or discard the right-hand value as needed. - if (right->AsLiteral() != NULL) { - Move(destination, right->AsLiteral()); - } else { - Visit(right); - Move(destination, right->location()); - } + Visit(right); + ASSERT_EQ(destination.type(), right->location().type()); __ bind(&done); } diff --git a/deps/v8/src/arm/frames-arm.cc b/deps/v8/src/arm/frames-arm.cc index b0fa13a..6fde4b7 100644 --- a/deps/v8/src/arm/frames-arm.cc +++ b/deps/v8/src/arm/frames-arm.cc @@ -54,24 +54,23 @@ StackFrame::Type ExitFrame::GetStateForFramePointer(Address fp, State* state) { if (fp == 0) return NONE; // Compute frame type and stack pointer. Address sp = fp + ExitFrameConstants::kSPDisplacement; - const int offset = ExitFrameConstants::kCodeOffset; - Object* code = Memory::Object_at(fp + offset); - bool is_debug_exit = code->IsSmi(); - if (is_debug_exit) { + Type type; + if (Memory::Address_at(fp + ExitFrameConstants::kDebugMarkOffset) != 0) { + type = EXIT_DEBUG; sp -= kNumJSCallerSaved * kPointerSize; + } else { + type = EXIT; } // Fill in the state. state->sp = sp; state->fp = fp; state->pc_address = reinterpret_cast(sp - 1 * kPointerSize); - return EXIT; + return type; } void ExitFrame::Iterate(ObjectVisitor* v) const { - v->VisitPointer(&code_slot()); - // The arguments are traversed as part of the expression stack of - // the calling frame. + // Do nothing } diff --git a/deps/v8/src/arm/frames-arm.h b/deps/v8/src/arm/frames-arm.h index 4924c1a..0874c09 100644 --- a/deps/v8/src/arm/frames-arm.h +++ b/deps/v8/src/arm/frames-arm.h @@ -100,7 +100,7 @@ class ExitFrameConstants : public AllStatic { static const int kSPDisplacement = -1 * kPointerSize; // The debug marker is just above the frame pointer. - static const int kCodeOffset = -1 * kPointerSize; + static const int kDebugMarkOffset = -1 * kPointerSize; static const int kSavedRegistersOffset = 0 * kPointerSize; diff --git a/deps/v8/src/arm/macro-assembler-arm.cc b/deps/v8/src/arm/macro-assembler-arm.cc index dc73bad..45c6540 100644 --- a/deps/v8/src/arm/macro-assembler-arm.cc +++ b/deps/v8/src/arm/macro-assembler-arm.cc @@ -274,7 +274,9 @@ void MacroAssembler::LeaveFrame(StackFrame::Type type) { } -void MacroAssembler::EnterExitFrame(ExitFrame::Mode mode) { +void MacroAssembler::EnterExitFrame(StackFrame::Type type) { + ASSERT(type == StackFrame::EXIT || type == StackFrame::EXIT_DEBUG); + // Compute the argv pointer and keep it in a callee-saved register. // r0 is argc. add(r6, sp, Operand(r0, LSL, kPointerSizeLog2)); @@ -296,11 +298,8 @@ void MacroAssembler::EnterExitFrame(ExitFrame::Mode mode) { stm(db_w, sp, fp.bit() | ip.bit() | lr.bit()); mov(fp, Operand(sp)); // setup new frame pointer - if (mode == ExitFrame::MODE_DEBUG) { - mov(ip, Operand(Smi::FromInt(0))); - } else { - mov(ip, Operand(CodeObject())); - } + // Push debug marker. + mov(ip, Operand(type == StackFrame::EXIT_DEBUG ? 1 : 0)); push(ip); // Save the frame pointer and the context in top. @@ -317,7 +316,7 @@ void MacroAssembler::EnterExitFrame(ExitFrame::Mode mode) { #ifdef ENABLE_DEBUGGER_SUPPORT // Save the state of all registers to the stack from the memory // location. This is needed to allow nested break points. - if (mode == ExitFrame::MODE_DEBUG) { + if (type == StackFrame::EXIT_DEBUG) { // Use sp as base to push. CopyRegistersFromMemoryToStack(sp, kJSCallerSaved); } @@ -349,14 +348,14 @@ void MacroAssembler::AlignStack(int offset) { } -void MacroAssembler::LeaveExitFrame(ExitFrame::Mode mode) { +void MacroAssembler::LeaveExitFrame(StackFrame::Type type) { #ifdef ENABLE_DEBUGGER_SUPPORT // Restore the memory copy of the registers by digging them out from // the stack. This is needed to allow nested break points. - if (mode == ExitFrame::MODE_DEBUG) { + if (type == StackFrame::EXIT_DEBUG) { // This code intentionally clobbers r2 and r3. const int kCallerSavedSize = kNumJSCallerSaved * kPointerSize; - const int kOffset = ExitFrameConstants::kCodeOffset - kCallerSavedSize; + const int kOffset = ExitFrameConstants::kDebugMarkOffset - kCallerSavedSize; add(r3, fp, Operand(kOffset)); CopyRegistersFromStackToMemory(r3, r2, kJSCallerSaved); } diff --git a/deps/v8/src/arm/macro-assembler-arm.h b/deps/v8/src/arm/macro-assembler-arm.h index 6dc2b7a..e37bb5e 100644 --- a/deps/v8/src/arm/macro-assembler-arm.h +++ b/deps/v8/src/arm/macro-assembler-arm.h @@ -87,14 +87,14 @@ class MacroAssembler: public Assembler { void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } - // Enter specific kind of exit frame; either normal or debug mode. - // Expects the number of arguments in register r0 and + // Enter specific kind of exit frame; either EXIT or + // EXIT_DEBUG. Expects the number of arguments in register r0 and // the builtin function to call in register r1. Exits with argc in // r4, argv in r6, and and the builtin function to call in r5. - void EnterExitFrame(ExitFrame::Mode mode); + void EnterExitFrame(StackFrame::Type type); // Leave the current exit frame. Expects the return value in r0. - void LeaveExitFrame(ExitFrame::Mode mode); + void LeaveExitFrame(StackFrame::Type type); // Align the stack by optionally pushing a Smi zero. void AlignStack(int offset); diff --git a/deps/v8/src/assembler.cc b/deps/v8/src/assembler.cc index 34346a9..34595f8 100644 --- a/deps/v8/src/assembler.cc +++ b/deps/v8/src/assembler.cc @@ -522,10 +522,6 @@ ExternalReference::ExternalReference(Builtins::CFunctionId id) : address_(Redirect(Builtins::c_function_address(id))) {} -ExternalReference::ExternalReference(ApiFunction* fun) - : address_(Redirect(fun->address())) {} - - ExternalReference::ExternalReference(Builtins::Name name) : address_(Builtins::builtin_address(name)) {} @@ -612,27 +608,6 @@ ExternalReference ExternalReference::new_space_allocation_limit_address() { return ExternalReference(Heap::NewSpaceAllocationLimitAddress()); } - -ExternalReference ExternalReference::handle_scope_extensions_address() { - return ExternalReference(HandleScope::current_extensions_address()); -} - - -ExternalReference ExternalReference::handle_scope_next_address() { - return ExternalReference(HandleScope::current_next_address()); -} - - -ExternalReference ExternalReference::handle_scope_limit_address() { - return ExternalReference(HandleScope::current_limit_address()); -} - - -ExternalReference ExternalReference::scheduled_exception_address() { - return ExternalReference(Top::scheduled_exception_address()); -} - - #ifdef V8_NATIVE_REGEXP ExternalReference ExternalReference::re_check_stack_guard_state() { diff --git a/deps/v8/src/assembler.h b/deps/v8/src/assembler.h index 311dadd..21a66dd 100644 --- a/deps/v8/src/assembler.h +++ b/deps/v8/src/assembler.h @@ -373,8 +373,6 @@ class ExternalReference BASE_EMBEDDED { public: explicit ExternalReference(Builtins::CFunctionId id); - explicit ExternalReference(ApiFunction* ptr); - explicit ExternalReference(Builtins::Name name); explicit ExternalReference(Runtime::FunctionId id); @@ -424,12 +422,6 @@ class ExternalReference BASE_EMBEDDED { static ExternalReference double_fp_operation(Token::Value operation); static ExternalReference compare_doubles(); - static ExternalReference handle_scope_extensions_address(); - static ExternalReference handle_scope_next_address(); - static ExternalReference handle_scope_limit_address(); - - static ExternalReference scheduled_exception_address(); - Address address() const {return reinterpret_cast
(address_);} #ifdef ENABLE_DEBUGGER_SUPPORT diff --git a/deps/v8/src/ast.h b/deps/v8/src/ast.h index 9b7d9dd..be64dcb 100644 --- a/deps/v8/src/ast.h +++ b/deps/v8/src/ast.h @@ -162,7 +162,7 @@ class Statement: public AstNode { class Expression: public AstNode { public: - Expression() : location_(Location::Temporary()) {} + Expression() : location_(Location::Uninitialized()) {} virtual Expression* AsExpression() { return this; } diff --git a/deps/v8/src/code-stubs.cc b/deps/v8/src/code-stubs.cc index 7a2f859..73ff011 100644 --- a/deps/v8/src/code-stubs.cc +++ b/deps/v8/src/code-stubs.cc @@ -36,27 +36,10 @@ namespace v8 { namespace internal { Handle CodeStub::GetCode() { - bool custom_cache = has_custom_cache(); - - int index = 0; - uint32_t key = 0; - if (custom_cache) { - Code* cached; - if (GetCustomCache(&cached)) { - return Handle(cached); - } else { - index = NumberDictionary::kNotFound; - } - } else { - key = GetKey(); - index = Heap::code_stubs()->FindEntry(key); - if (index != NumberDictionary::kNotFound) - return Handle(Code::cast(Heap::code_stubs()->ValueAt(index))); - } - - Code* result; - { - v8::HandleScope scope; + uint32_t key = GetKey(); + int index = Heap::code_stubs()->FindEntry(key); + if (index == NumberDictionary::kNotFound) { + HandleScope scope; // Update the static counter each time a new code stub is generated. Counters::code_stubs.Increment(); @@ -96,21 +79,18 @@ Handle CodeStub::GetCode() { } #endif - if (custom_cache) { - SetCustomCache(*code); - } else { - // Update the dictionary and the root in Heap. - Handle dict = - Factory::DictionaryAtNumberPut( - Handle(Heap::code_stubs()), - key, - code); - Heap::public_set_code_stubs(*dict); - } - result = *code; + // Update the dictionary and the root in Heap. + Handle dict = + Factory::DictionaryAtNumberPut( + Handle(Heap::code_stubs()), + key, + code); + Heap::public_set_code_stubs(*dict); + index = Heap::code_stubs()->FindEntry(key); } + ASSERT(index != NumberDictionary::kNotFound); - return Handle(result); + return Handle(Code::cast(Heap::code_stubs()->ValueAt(index))); } diff --git a/deps/v8/src/code-stubs.h b/deps/v8/src/code-stubs.h index 63461bc..121140d 100644 --- a/deps/v8/src/code-stubs.h +++ b/deps/v8/src/code-stubs.h @@ -75,7 +75,6 @@ class CodeStub BASE_EMBEDDED { #define DEF_ENUM(name) name, CODE_STUB_LIST(DEF_ENUM) #undef DEF_ENUM - NoCache, // marker for stubs that do custom caching NUMBER_OF_IDS }; @@ -92,12 +91,6 @@ class CodeStub BASE_EMBEDDED { virtual ~CodeStub() {} - // Override these methods to provide a custom caching mechanism for - // an individual type of code stub. - virtual bool GetCustomCache(Code** code_out) { return false; } - virtual void SetCustomCache(Code* value) { } - virtual bool has_custom_cache() { return false; } - protected: static const int kMajorBits = 5; static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; diff --git a/deps/v8/src/codegen.cc b/deps/v8/src/codegen.cc index f2788a8..28c0ba5 100644 --- a/deps/v8/src/codegen.cc +++ b/deps/v8/src/codegen.cc @@ -551,20 +551,4 @@ void ArgumentsAccessStub::Generate(MacroAssembler* masm) { } -bool ApiGetterEntryStub::GetCustomCache(Code** code_out) { - Object* cache = info()->load_stub_cache(); - if (cache->IsUndefined()) { - return false; - } else { - *code_out = Code::cast(cache); - return true; - } -} - - -void ApiGetterEntryStub::SetCustomCache(Code* value) { - info()->set_load_stub_cache(value); -} - - } } // namespace v8::internal diff --git a/deps/v8/src/codegen.h b/deps/v8/src/codegen.h index fc4a53b..8c1b733 100644 --- a/deps/v8/src/codegen.h +++ b/deps/v8/src/codegen.h @@ -301,7 +301,7 @@ class CEntryStub : public CodeStub { Label* throw_normal_exception, Label* throw_termination_exception, Label* throw_out_of_memory_exception, - ExitFrame::Mode mode, + StackFrame::Type frame_type, bool do_gc, bool always_allocate_scope); void GenerateThrowTOS(MacroAssembler* masm); @@ -320,32 +320,6 @@ class CEntryStub : public CodeStub { }; -class ApiGetterEntryStub : public CodeStub { - public: - ApiGetterEntryStub(Handle info, - ApiFunction* fun) - : info_(info), - fun_(fun) { } - void Generate(MacroAssembler* masm); - virtual bool has_custom_cache() { return true; } - virtual bool GetCustomCache(Code** code_out); - virtual void SetCustomCache(Code* value); - - static const int kStackSpace = 6; - static const int kArgc = 4; - private: - Handle info() { return info_; } - ApiFunction* fun() { return fun_; } - Major MajorKey() { return NoCache; } - int MinorKey() { return 0; } - const char* GetName() { return "ApiEntryStub"; } - // The accessor info associated with the function. - Handle info_; - // The function to be called. - ApiFunction* fun_; -}; - - class CEntryDebugBreakStub : public CEntryStub { public: CEntryDebugBreakStub() : CEntryStub(1) { } diff --git a/deps/v8/src/compiler.cc b/deps/v8/src/compiler.cc index bad209e..129f1aa 100644 --- a/deps/v8/src/compiler.cc +++ b/deps/v8/src/compiler.cc @@ -48,7 +48,7 @@ class CodeGenSelector: public AstVisitor { CodeGenSelector() : has_supported_syntax_(true), - location_(Location::Nowhere()) { + location_(Location::Uninitialized()) { } CodeGenTag Select(FunctionLiteral* fun); @@ -514,11 +514,11 @@ void CodeGenSelector::VisitStatements(ZoneList* stmts) { void CodeGenSelector::VisitAsEffect(Expression* expr) { - if (location_.is_nowhere()) { + if (location_.is_effect()) { Visit(expr); } else { Location saved = location_; - location_ = Location::Nowhere(); + location_ = Location::Effect(); Visit(expr); location_ = saved; } @@ -526,11 +526,11 @@ void CodeGenSelector::VisitAsEffect(Expression* expr) { void CodeGenSelector::VisitAsValue(Expression* expr) { - if (location_.is_temporary()) { + if (location_.is_value()) { Visit(expr); } else { Location saved = location_; - location_ = Location::Temporary(); + location_ = Location::Value(); Visit(expr); location_ = saved; } @@ -849,6 +849,12 @@ void CodeGenSelector::VisitCountOperation(CountOperation* expr) { void CodeGenSelector::VisitBinaryOperation(BinaryOperation* expr) { switch (expr->op()) { + case Token::COMMA: + VisitAsEffect(expr->left()); + CHECK_BAILOUT; + Visit(expr->right()); // Location is the same as the parent location. + break; + case Token::OR: VisitAsValue(expr->left()); CHECK_BAILOUT; @@ -857,6 +863,22 @@ void CodeGenSelector::VisitBinaryOperation(BinaryOperation* expr) { Visit(expr->right()); break; + case Token::ADD: + case Token::SUB: + case Token::DIV: + case Token::MOD: + case Token::MUL: + case Token::BIT_OR: + case Token::BIT_AND: + case Token::BIT_XOR: + case Token::SHL: + case Token::SHR: + case Token::SAR: + VisitAsValue(expr->left()); + CHECK_BAILOUT; + VisitAsValue(expr->right()); + break; + default: BAILOUT("Unsupported binary operation"); } diff --git a/deps/v8/src/fast-codegen.cc b/deps/v8/src/fast-codegen.cc index 8655e97..2f6a27a 100644 --- a/deps/v8/src/fast-codegen.cc +++ b/deps/v8/src/fast-codegen.cc @@ -71,30 +71,15 @@ int FastCodeGenerator::SlotOffset(Slot* slot) { } -void FastCodeGenerator::Move(Location destination, Location source) { - switch (destination.type()) { - case Location::NOWHERE: - break; - - case Location::TEMP: - switch (source.type()) { - case Location::NOWHERE: - UNREACHABLE(); - case Location::TEMP: - break; - } - break; - } -} - - // All platform macro assemblers in {ia32,x64,arm} have a push(Register) // function. void FastCodeGenerator::Move(Location destination, Register source) { switch (destination.type()) { - case Location::NOWHERE: + case Location::kUninitialized: + UNREACHABLE(); + case Location::kEffect: break; - case Location::TEMP: + case Location::kValue: masm_->push(source); break; } @@ -105,9 +90,10 @@ void FastCodeGenerator::Move(Location destination, Register source) { // function. void FastCodeGenerator::Move(Register destination, Location source) { switch (source.type()) { - case Location::NOWHERE: + case Location::kUninitialized: // Fall through. + case Location::kEffect: UNREACHABLE(); - case Location::TEMP: + case Location::kValue: masm_->pop(destination); } } diff --git a/deps/v8/src/fast-codegen.h b/deps/v8/src/fast-codegen.h index a718157..31bb41c 100644 --- a/deps/v8/src/fast-codegen.h +++ b/deps/v8/src/fast-codegen.h @@ -51,8 +51,6 @@ class FastCodeGenerator: public AstVisitor { private: int SlotOffset(Slot* slot); - void Move(Location destination, Location source); - void Move(Location destination, Register source); void Move(Location destination, Slot* source); void Move(Location destination, Literal* source); @@ -78,6 +76,9 @@ class FastCodeGenerator: public AstVisitor { AST_NODE_LIST(DECLARE_VISIT) #undef DECLARE_VISIT + // Handles the shortcutted logical binary operations in VisitBinaryOperation. + void EmitLogicalOperation(BinaryOperation* expr); + MacroAssembler* masm_; FunctionLiteral* function_; Handle