|
@ -166,6 +166,11 @@ void FullCodeGenerator::Generate(CompilationInfo* info) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
set_stack_height(2 + scope()->num_stack_slots()); |
|
|
|
|
|
if (FLAG_verify_stack_height) { |
|
|
|
|
|
verify_stack_height(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
bool function_in_register = true; |
|
|
bool function_in_register = true; |
|
|
|
|
|
|
|
|
// Possibly allocate a local context.
|
|
|
// Possibly allocate a local context.
|
|
@ -358,6 +363,15 @@ void FullCodeGenerator::EmitReturnSequence() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FullCodeGenerator::verify_stack_height() { |
|
|
|
|
|
ASSERT(FLAG_verify_stack_height); |
|
|
|
|
|
__ sub(Operand(ebp), Immediate(kPointerSize * stack_height())); |
|
|
|
|
|
__ cmp(ebp, Operand(esp)); |
|
|
|
|
|
__ Assert(equal, "Full codegen stack height not as expected."); |
|
|
|
|
|
__ add(Operand(ebp), Immediate(kPointerSize * stack_height())); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FullCodeGenerator::EffectContext::Plug(Slot* slot) const { |
|
|
void FullCodeGenerator::EffectContext::Plug(Slot* slot) const { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -372,6 +386,7 @@ void FullCodeGenerator::StackValueContext::Plug(Slot* slot) const { |
|
|
MemOperand slot_operand = codegen()->EmitSlotSearch(slot, result_register()); |
|
|
MemOperand slot_operand = codegen()->EmitSlotSearch(slot, result_register()); |
|
|
// Memory operands can be pushed directly.
|
|
|
// Memory operands can be pushed directly.
|
|
|
__ push(slot_operand); |
|
|
__ push(slot_operand); |
|
|
|
|
|
codegen()->increment_stack_height(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -425,6 +440,7 @@ void FullCodeGenerator::StackValueContext::Plug(Handle<Object> lit) const { |
|
|
} else { |
|
|
} else { |
|
|
__ push(Immediate(lit)); |
|
|
__ push(Immediate(lit)); |
|
|
} |
|
|
} |
|
|
|
|
|
codegen()->increment_stack_height(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -462,6 +478,7 @@ void FullCodeGenerator::EffectContext::DropAndPlug(int count, |
|
|
Register reg) const { |
|
|
Register reg) const { |
|
|
ASSERT(count > 0); |
|
|
ASSERT(count > 0); |
|
|
__ Drop(count); |
|
|
__ Drop(count); |
|
|
|
|
|
codegen()->decrement_stack_height(count); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -471,6 +488,7 @@ void FullCodeGenerator::AccumulatorValueContext::DropAndPlug( |
|
|
ASSERT(count > 0); |
|
|
ASSERT(count > 0); |
|
|
__ Drop(count); |
|
|
__ Drop(count); |
|
|
__ Move(result_register(), reg); |
|
|
__ Move(result_register(), reg); |
|
|
|
|
|
codegen()->decrement_stack_height(count); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -479,6 +497,7 @@ void FullCodeGenerator::StackValueContext::DropAndPlug(int count, |
|
|
ASSERT(count > 0); |
|
|
ASSERT(count > 0); |
|
|
if (count > 1) __ Drop(count - 1); |
|
|
if (count > 1) __ Drop(count - 1); |
|
|
__ mov(Operand(esp, 0), reg); |
|
|
__ mov(Operand(esp, 0), reg); |
|
|
|
|
|
codegen()->decrement_stack_height(count - 1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -490,6 +509,7 @@ void FullCodeGenerator::TestContext::DropAndPlug(int count, |
|
|
__ Move(result_register(), reg); |
|
|
__ Move(result_register(), reg); |
|
|
codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); |
|
|
codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); |
|
|
codegen()->DoTest(this); |
|
|
codegen()->DoTest(this); |
|
|
|
|
|
codegen()->decrement_stack_height(count); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -523,6 +543,7 @@ void FullCodeGenerator::StackValueContext::Plug( |
|
|
__ bind(materialize_false); |
|
|
__ bind(materialize_false); |
|
|
__ push(Immediate(isolate()->factory()->false_value())); |
|
|
__ push(Immediate(isolate()->factory()->false_value())); |
|
|
__ bind(&done); |
|
|
__ bind(&done); |
|
|
|
|
|
codegen()->increment_stack_height(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -550,6 +571,7 @@ void FullCodeGenerator::StackValueContext::Plug(bool flag) const { |
|
|
? isolate()->factory()->true_value() |
|
|
? isolate()->factory()->true_value() |
|
|
: isolate()->factory()->false_value(); |
|
|
: isolate()->factory()->false_value(); |
|
|
__ push(Immediate(value)); |
|
|
__ push(Immediate(value)); |
|
|
|
|
|
codegen()->increment_stack_height(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -572,7 +594,7 @@ void FullCodeGenerator::DoTest(Expression* condition, |
|
|
Label* fall_through) { |
|
|
Label* fall_through) { |
|
|
ToBooleanStub stub(result_register()); |
|
|
ToBooleanStub stub(result_register()); |
|
|
__ push(result_register()); |
|
|
__ push(result_register()); |
|
|
__ CallStub(&stub); |
|
|
__ CallStub(&stub, condition->test_id()); |
|
|
__ test(result_register(), Operand(result_register())); |
|
|
__ test(result_register(), Operand(result_register())); |
|
|
// The stub returns nonzero for true.
|
|
|
// The stub returns nonzero for true.
|
|
|
Split(not_zero, if_true, if_false, fall_through); |
|
|
Split(not_zero, if_true, if_false, fall_through); |
|
@ -722,14 +744,18 @@ void FullCodeGenerator::EmitDeclaration(Variable* variable, |
|
|
// Note: For variables we must not push an initial value (such as
|
|
|
// Note: For variables we must not push an initial value (such as
|
|
|
// 'undefined') because we may have a (legal) redeclaration and we
|
|
|
// 'undefined') because we may have a (legal) redeclaration and we
|
|
|
// must not destroy the current value.
|
|
|
// must not destroy the current value.
|
|
|
|
|
|
increment_stack_height(3); |
|
|
if (mode == Variable::CONST) { |
|
|
if (mode == Variable::CONST) { |
|
|
__ push(Immediate(isolate()->factory()->the_hole_value())); |
|
|
__ push(Immediate(isolate()->factory()->the_hole_value())); |
|
|
|
|
|
increment_stack_height(); |
|
|
} else if (function != NULL) { |
|
|
} else if (function != NULL) { |
|
|
VisitForStackValue(function); |
|
|
VisitForStackValue(function); |
|
|
} else { |
|
|
} else { |
|
|
__ push(Immediate(Smi::FromInt(0))); // No initial value!
|
|
|
__ push(Immediate(Smi::FromInt(0))); // No initial value!
|
|
|
|
|
|
increment_stack_height(); |
|
|
} |
|
|
} |
|
|
__ CallRuntime(Runtime::kDeclareContextSlot, 4); |
|
|
__ CallRuntime(Runtime::kDeclareContextSlot, 4); |
|
|
|
|
|
decrement_stack_height(4); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -748,8 +774,10 @@ void FullCodeGenerator::EmitDeclaration(Variable* variable, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
__ push(eax); |
|
|
__ push(eax); |
|
|
|
|
|
increment_stack_height(); |
|
|
VisitForAccumulatorValue(function); |
|
|
VisitForAccumulatorValue(function); |
|
|
__ pop(edx); |
|
|
__ pop(edx); |
|
|
|
|
|
decrement_stack_height(); |
|
|
|
|
|
|
|
|
ASSERT(prop->key()->AsLiteral() != NULL && |
|
|
ASSERT(prop->key()->AsLiteral() != NULL && |
|
|
prop->key()->AsLiteral()->handle()->IsSmi()); |
|
|
prop->key()->AsLiteral()->handle()->IsSmi()); |
|
@ -785,6 +813,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { |
|
|
Breakable nested_statement(this, stmt); |
|
|
Breakable nested_statement(this, stmt); |
|
|
SetStatementPosition(stmt); |
|
|
SetStatementPosition(stmt); |
|
|
|
|
|
|
|
|
|
|
|
int switch_clause_stack_height = stack_height(); |
|
|
// Keep the switch value on the stack until a case matches.
|
|
|
// Keep the switch value on the stack until a case matches.
|
|
|
VisitForStackValue(stmt->tag()); |
|
|
VisitForStackValue(stmt->tag()); |
|
|
PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); |
|
|
PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); |
|
@ -849,6 +878,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { |
|
|
__ jmp(default_clause->body_target()); |
|
|
__ jmp(default_clause->body_target()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
set_stack_height(switch_clause_stack_height); |
|
|
// Compile all the case bodies.
|
|
|
// Compile all the case bodies.
|
|
|
for (int i = 0; i < clauses->length(); i++) { |
|
|
for (int i = 0; i < clauses->length(); i++) { |
|
|
Comment cmnt(masm_, "[ Case body"); |
|
|
Comment cmnt(masm_, "[ Case body"); |
|
@ -890,6 +920,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
|
|
__ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
|
|
__ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
|
|
__ bind(&done_convert); |
|
|
__ bind(&done_convert); |
|
|
__ push(eax); |
|
|
__ push(eax); |
|
|
|
|
|
increment_stack_height(); |
|
|
|
|
|
|
|
|
// Check cache validity in generated code. This is a fast case for
|
|
|
// Check cache validity in generated code. This is a fast case for
|
|
|
// the JSObject::IsSimpleEnum cache validity checks. If we cannot
|
|
|
// the JSObject::IsSimpleEnum cache validity checks. If we cannot
|
|
@ -973,6 +1004,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
|
|
__ push(eax); // Fixed array length (as smi).
|
|
|
__ push(eax); // Fixed array length (as smi).
|
|
|
__ push(Immediate(Smi::FromInt(0))); // Initial index.
|
|
|
__ push(Immediate(Smi::FromInt(0))); // Initial index.
|
|
|
|
|
|
|
|
|
|
|
|
increment_stack_height(4); |
|
|
// Generate code for doing the condition check.
|
|
|
// Generate code for doing the condition check.
|
|
|
__ bind(&loop); |
|
|
__ bind(&loop); |
|
|
__ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index.
|
|
|
__ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index.
|
|
@ -1028,6 +1060,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
|
|
__ bind(loop_statement.break_target()); |
|
|
__ bind(loop_statement.break_target()); |
|
|
__ add(Operand(esp), Immediate(5 * kPointerSize)); |
|
|
__ add(Operand(esp), Immediate(5 * kPointerSize)); |
|
|
|
|
|
|
|
|
|
|
|
decrement_stack_height(5); |
|
|
// Exit and decrement the loop depth.
|
|
|
// Exit and decrement the loop depth.
|
|
|
__ bind(&exit); |
|
|
__ bind(&exit); |
|
|
decrement_loop_depth(); |
|
|
decrement_loop_depth(); |
|
@ -1363,6 +1396,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
|
|
if (!result_saved) { |
|
|
if (!result_saved) { |
|
|
__ push(eax); // Save result on the stack
|
|
|
__ push(eax); // Save result on the stack
|
|
|
result_saved = true; |
|
|
result_saved = true; |
|
|
|
|
|
increment_stack_height(); |
|
|
} |
|
|
} |
|
|
switch (property->kind()) { |
|
|
switch (property->kind()) { |
|
|
case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
|
|
case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
|
@ -1387,6 +1421,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
|
|
// Fall through.
|
|
|
// Fall through.
|
|
|
case ObjectLiteral::Property::PROTOTYPE: |
|
|
case ObjectLiteral::Property::PROTOTYPE: |
|
|
__ push(Operand(esp, 0)); // Duplicate receiver.
|
|
|
__ push(Operand(esp, 0)); // Duplicate receiver.
|
|
|
|
|
|
increment_stack_height(); |
|
|
VisitForStackValue(key); |
|
|
VisitForStackValue(key); |
|
|
VisitForStackValue(value); |
|
|
VisitForStackValue(value); |
|
|
if (property->emit_store()) { |
|
|
if (property->emit_store()) { |
|
@ -1395,16 +1430,20 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
|
|
} else { |
|
|
} else { |
|
|
__ Drop(3); |
|
|
__ Drop(3); |
|
|
} |
|
|
} |
|
|
|
|
|
decrement_stack_height(3); |
|
|
break; |
|
|
break; |
|
|
case ObjectLiteral::Property::SETTER: |
|
|
case ObjectLiteral::Property::SETTER: |
|
|
case ObjectLiteral::Property::GETTER: |
|
|
case ObjectLiteral::Property::GETTER: |
|
|
__ push(Operand(esp, 0)); // Duplicate receiver.
|
|
|
__ push(Operand(esp, 0)); // Duplicate receiver.
|
|
|
|
|
|
increment_stack_height(); |
|
|
VisitForStackValue(key); |
|
|
VisitForStackValue(key); |
|
|
__ push(Immediate(property->kind() == ObjectLiteral::Property::SETTER ? |
|
|
__ push(Immediate(property->kind() == ObjectLiteral::Property::SETTER ? |
|
|
Smi::FromInt(1) : |
|
|
Smi::FromInt(1) : |
|
|
Smi::FromInt(0))); |
|
|
Smi::FromInt(0))); |
|
|
|
|
|
increment_stack_height(); |
|
|
VisitForStackValue(value); |
|
|
VisitForStackValue(value); |
|
|
__ CallRuntime(Runtime::kDefineAccessor, 4); |
|
|
__ CallRuntime(Runtime::kDefineAccessor, 4); |
|
|
|
|
|
decrement_stack_height(4); |
|
|
break; |
|
|
break; |
|
|
default: UNREACHABLE(); |
|
|
default: UNREACHABLE(); |
|
|
} |
|
|
} |
|
@ -1467,6 +1506,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
|
|
if (!result_saved) { |
|
|
if (!result_saved) { |
|
|
__ push(eax); |
|
|
__ push(eax); |
|
|
result_saved = true; |
|
|
result_saved = true; |
|
|
|
|
|
increment_stack_height(); |
|
|
} |
|
|
} |
|
|
VisitForAccumulatorValue(subexpr); |
|
|
VisitForAccumulatorValue(subexpr); |
|
|
|
|
|
|
|
@ -1495,7 +1535,9 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
|
|
// Invalid left-hand sides are rewritten to have a 'throw ReferenceError'
|
|
|
// Invalid left-hand sides are rewritten to have a 'throw ReferenceError'
|
|
|
// on the left-hand side.
|
|
|
// on the left-hand side.
|
|
|
if (!expr->target()->IsValidLeftHandSide()) { |
|
|
if (!expr->target()->IsValidLeftHandSide()) { |
|
|
VisitForEffect(expr->target()); |
|
|
ASSERT(expr->target()->AsThrow() != NULL); |
|
|
|
|
|
VisitInCurrentContext(expr->target()); // Throw does not plug the context
|
|
|
|
|
|
context()->Plug(eax); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1520,6 +1562,7 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
|
|
// We need the receiver both on the stack and in the accumulator.
|
|
|
// We need the receiver both on the stack and in the accumulator.
|
|
|
VisitForAccumulatorValue(property->obj()); |
|
|
VisitForAccumulatorValue(property->obj()); |
|
|
__ push(result_register()); |
|
|
__ push(result_register()); |
|
|
|
|
|
increment_stack_height(); |
|
|
} else { |
|
|
} else { |
|
|
VisitForStackValue(property->obj()); |
|
|
VisitForStackValue(property->obj()); |
|
|
} |
|
|
} |
|
@ -1530,6 +1573,7 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
|
|
VisitForAccumulatorValue(property->key()); |
|
|
VisitForAccumulatorValue(property->key()); |
|
|
__ mov(edx, Operand(esp, 0)); |
|
|
__ mov(edx, Operand(esp, 0)); |
|
|
__ push(eax); |
|
|
__ push(eax); |
|
|
|
|
|
increment_stack_height(); |
|
|
} else { |
|
|
} else { |
|
|
VisitForStackValue(property->obj()); |
|
|
VisitForStackValue(property->obj()); |
|
|
VisitForStackValue(property->key()); |
|
|
VisitForStackValue(property->key()); |
|
@ -1541,7 +1585,8 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
|
|
// For compound assignments we need another deoptimization point after the
|
|
|
// For compound assignments we need another deoptimization point after the
|
|
|
// variable/property load.
|
|
|
// variable/property load.
|
|
|
if (expr->is_compound()) { |
|
|
if (expr->is_compound()) { |
|
|
{ AccumulatorValueContext context(this); |
|
|
AccumulatorValueContext result_context(this); |
|
|
|
|
|
{ AccumulatorValueContext left_operand_context(this); |
|
|
switch (assign_type) { |
|
|
switch (assign_type) { |
|
|
case VARIABLE: |
|
|
case VARIABLE: |
|
|
EmitVariableLoad(expr->target()->AsVariableProxy()); |
|
|
EmitVariableLoad(expr->target()->AsVariableProxy()); |
|
@ -1560,13 +1605,13 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
|
|
|
|
|
|
|
|
Token::Value op = expr->binary_op(); |
|
|
Token::Value op = expr->binary_op(); |
|
|
__ push(eax); // Left operand goes on the stack.
|
|
|
__ push(eax); // Left operand goes on the stack.
|
|
|
|
|
|
increment_stack_height(); |
|
|
VisitForAccumulatorValue(expr->value()); |
|
|
VisitForAccumulatorValue(expr->value()); |
|
|
|
|
|
|
|
|
OverwriteMode mode = expr->value()->ResultOverwriteAllowed() |
|
|
OverwriteMode mode = expr->value()->ResultOverwriteAllowed() |
|
|
? OVERWRITE_RIGHT |
|
|
? OVERWRITE_RIGHT |
|
|
: NO_OVERWRITE; |
|
|
: NO_OVERWRITE; |
|
|
SetSourcePosition(expr->position() + 1); |
|
|
SetSourcePosition(expr->position() + 1); |
|
|
AccumulatorValueContext context(this); |
|
|
|
|
|
if (ShouldInlineSmiCase(op)) { |
|
|
if (ShouldInlineSmiCase(op)) { |
|
|
EmitInlineSmiBinaryOp(expr->binary_operation(), |
|
|
EmitInlineSmiBinaryOp(expr->binary_operation(), |
|
|
op, |
|
|
op, |
|
@ -1630,6 +1675,7 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
|
|
// stack. Right operand is in eax.
|
|
|
// stack. Right operand is in eax.
|
|
|
Label smi_case, done, stub_call; |
|
|
Label smi_case, done, stub_call; |
|
|
__ pop(edx); |
|
|
__ pop(edx); |
|
|
|
|
|
decrement_stack_height(); |
|
|
__ mov(ecx, eax); |
|
|
__ mov(ecx, eax); |
|
|
__ or_(eax, Operand(edx)); |
|
|
__ or_(eax, Operand(edx)); |
|
|
JumpPatchSite patch_site(masm_); |
|
|
JumpPatchSite patch_site(masm_); |
|
@ -1721,6 +1767,7 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
|
|
Token::Value op, |
|
|
Token::Value op, |
|
|
OverwriteMode mode) { |
|
|
OverwriteMode mode) { |
|
|
__ pop(edx); |
|
|
__ pop(edx); |
|
|
|
|
|
decrement_stack_height(); |
|
|
BinaryOpStub stub(op, mode); |
|
|
BinaryOpStub stub(op, mode); |
|
|
JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
|
|
|
JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
|
|
|
__ call(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id()); |
|
|
__ call(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id()); |
|
@ -1733,7 +1780,9 @@ void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { |
|
|
// Invalid left-hand sides are rewritten to have a 'throw
|
|
|
// Invalid left-hand sides are rewritten to have a 'throw
|
|
|
// ReferenceError' on the left-hand side.
|
|
|
// ReferenceError' on the left-hand side.
|
|
|
if (!expr->IsValidLeftHandSide()) { |
|
|
if (!expr->IsValidLeftHandSide()) { |
|
|
VisitForEffect(expr); |
|
|
ASSERT(expr->AsThrow() != NULL); |
|
|
|
|
|
VisitInCurrentContext(expr); // Throw does not plug the context
|
|
|
|
|
|
context()->Plug(eax); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1757,9 +1806,11 @@ void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { |
|
|
} |
|
|
} |
|
|
case NAMED_PROPERTY: { |
|
|
case NAMED_PROPERTY: { |
|
|
__ push(eax); // Preserve value.
|
|
|
__ push(eax); // Preserve value.
|
|
|
|
|
|
increment_stack_height(); |
|
|
VisitForAccumulatorValue(prop->obj()); |
|
|
VisitForAccumulatorValue(prop->obj()); |
|
|
__ mov(edx, eax); |
|
|
__ mov(edx, eax); |
|
|
__ pop(eax); // Restore value.
|
|
|
__ pop(eax); // Restore value.
|
|
|
|
|
|
decrement_stack_height(); |
|
|
__ mov(ecx, prop->key()->AsLiteral()->handle()); |
|
|
__ mov(ecx, prop->key()->AsLiteral()->handle()); |
|
|
Handle<Code> ic = is_strict_mode() |
|
|
Handle<Code> ic = is_strict_mode() |
|
|
? isolate()->builtins()->StoreIC_Initialize_Strict() |
|
|
? isolate()->builtins()->StoreIC_Initialize_Strict() |
|
@ -1769,6 +1820,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { |
|
|
} |
|
|
} |
|
|
case KEYED_PROPERTY: { |
|
|
case KEYED_PROPERTY: { |
|
|
__ push(eax); // Preserve value.
|
|
|
__ push(eax); // Preserve value.
|
|
|
|
|
|
increment_stack_height(); |
|
|
if (prop->is_synthetic()) { |
|
|
if (prop->is_synthetic()) { |
|
|
ASSERT(prop->obj()->AsVariableProxy() != NULL); |
|
|
ASSERT(prop->obj()->AsVariableProxy() != NULL); |
|
|
ASSERT(prop->key()->AsLiteral() != NULL); |
|
|
ASSERT(prop->key()->AsLiteral() != NULL); |
|
@ -1782,8 +1834,10 @@ void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { |
|
|
VisitForAccumulatorValue(prop->key()); |
|
|
VisitForAccumulatorValue(prop->key()); |
|
|
__ mov(ecx, eax); |
|
|
__ mov(ecx, eax); |
|
|
__ pop(edx); |
|
|
__ pop(edx); |
|
|
|
|
|
decrement_stack_height(); |
|
|
} |
|
|
} |
|
|
__ pop(eax); // Restore value.
|
|
|
__ pop(eax); // Restore value.
|
|
|
|
|
|
decrement_stack_height(); |
|
|
Handle<Code> ic = is_strict_mode() |
|
|
Handle<Code> ic = is_strict_mode() |
|
|
? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
|
|
? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
|
|
: isolate()->builtins()->KeyedStoreIC_Initialize(); |
|
|
: isolate()->builtins()->KeyedStoreIC_Initialize(); |
|
@ -1900,6 +1954,7 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
|
|
__ mov(edx, Operand(esp, 0)); |
|
|
__ mov(edx, Operand(esp, 0)); |
|
|
} else { |
|
|
} else { |
|
|
__ pop(edx); |
|
|
__ pop(edx); |
|
|
|
|
|
decrement_stack_height(); |
|
|
} |
|
|
} |
|
|
Handle<Code> ic = is_strict_mode() |
|
|
Handle<Code> ic = is_strict_mode() |
|
|
? isolate()->builtins()->StoreIC_Initialize_Strict() |
|
|
? isolate()->builtins()->StoreIC_Initialize_Strict() |
|
@ -1913,6 +1968,7 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
|
|
__ CallRuntime(Runtime::kToFastProperties, 1); |
|
|
__ CallRuntime(Runtime::kToFastProperties, 1); |
|
|
__ pop(eax); |
|
|
__ pop(eax); |
|
|
__ Drop(1); |
|
|
__ Drop(1); |
|
|
|
|
|
decrement_stack_height(); |
|
|
} |
|
|
} |
|
|
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
|
|
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
@ -1934,10 +1990,12 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
__ pop(ecx); |
|
|
__ pop(ecx); |
|
|
|
|
|
decrement_stack_height(); |
|
|
if (expr->ends_initialization_block()) { |
|
|
if (expr->ends_initialization_block()) { |
|
|
__ mov(edx, Operand(esp, 0)); // Leave receiver on the stack for later.
|
|
|
__ mov(edx, Operand(esp, 0)); // Leave receiver on the stack for later.
|
|
|
} else { |
|
|
} else { |
|
|
__ pop(edx); |
|
|
__ pop(edx); |
|
|
|
|
|
decrement_stack_height(); |
|
|
} |
|
|
} |
|
|
// Record source code position before IC call.
|
|
|
// Record source code position before IC call.
|
|
|
SetSourcePosition(expr->position()); |
|
|
SetSourcePosition(expr->position()); |
|
@ -1953,6 +2011,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
|
|
__ push(edx); |
|
|
__ push(edx); |
|
|
__ CallRuntime(Runtime::kToFastProperties, 1); |
|
|
__ CallRuntime(Runtime::kToFastProperties, 1); |
|
|
__ pop(eax); |
|
|
__ pop(eax); |
|
|
|
|
|
decrement_stack_height(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
|
|
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
|
@ -1972,6 +2031,7 @@ void FullCodeGenerator::VisitProperty(Property* expr) { |
|
|
VisitForStackValue(expr->obj()); |
|
|
VisitForStackValue(expr->obj()); |
|
|
VisitForAccumulatorValue(expr->key()); |
|
|
VisitForAccumulatorValue(expr->key()); |
|
|
__ pop(edx); |
|
|
__ pop(edx); |
|
|
|
|
|
decrement_stack_height(); |
|
|
EmitKeyedPropertyLoad(expr); |
|
|
EmitKeyedPropertyLoad(expr); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
@ -1999,6 +2059,7 @@ void FullCodeGenerator::EmitCallWithIC(Call* expr, |
|
|
RecordJSReturnSite(expr); |
|
|
RecordJSReturnSite(expr); |
|
|
// Restore context register.
|
|
|
// Restore context register.
|
|
|
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
|
|
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
|
|
|
|
|
decrement_stack_height(arg_count + 1); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2013,6 +2074,7 @@ void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, |
|
|
__ pop(ecx); |
|
|
__ pop(ecx); |
|
|
__ push(eax); |
|
|
__ push(eax); |
|
|
__ push(ecx); |
|
|
__ push(ecx); |
|
|
|
|
|
increment_stack_height(); |
|
|
|
|
|
|
|
|
// Load the arguments.
|
|
|
// Load the arguments.
|
|
|
ZoneList<Expression*>* args = expr->arguments(); |
|
|
ZoneList<Expression*>* args = expr->arguments(); |
|
@ -2032,6 +2094,7 @@ void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, |
|
|
RecordJSReturnSite(expr); |
|
|
RecordJSReturnSite(expr); |
|
|
// Restore context register.
|
|
|
// Restore context register.
|
|
|
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
|
|
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
|
|
|
|
|
decrement_stack_height(arg_count + 1); |
|
|
context()->DropAndPlug(1, eax); // Drop the key still on the stack.
|
|
|
context()->DropAndPlug(1, eax); // Drop the key still on the stack.
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2053,6 +2116,8 @@ void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { |
|
|
RecordJSReturnSite(expr); |
|
|
RecordJSReturnSite(expr); |
|
|
// Restore context register.
|
|
|
// Restore context register.
|
|
|
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
|
|
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
|
|
|
|
|
|
|
|
|
|
|
decrement_stack_height(arg_count + 1); |
|
|
context()->DropAndPlug(1, eax); |
|
|
context()->DropAndPlug(1, eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2100,7 +2165,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
|
|
VisitForStackValue(fun); |
|
|
VisitForStackValue(fun); |
|
|
// Reserved receiver slot.
|
|
|
// Reserved receiver slot.
|
|
|
__ push(Immediate(isolate()->factory()->undefined_value())); |
|
|
__ push(Immediate(isolate()->factory()->undefined_value())); |
|
|
|
|
|
increment_stack_height(); |
|
|
// Push the arguments.
|
|
|
// Push the arguments.
|
|
|
for (int i = 0; i < arg_count; i++) { |
|
|
for (int i = 0; i < arg_count; i++) { |
|
|
VisitForStackValue(args->at(i)); |
|
|
VisitForStackValue(args->at(i)); |
|
@ -2144,10 +2209,12 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
|
|
RecordJSReturnSite(expr); |
|
|
RecordJSReturnSite(expr); |
|
|
// Restore context register.
|
|
|
// Restore context register.
|
|
|
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
|
|
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
|
|
|
|
|
decrement_stack_height(arg_count + 1); // Function is left on the stack.
|
|
|
context()->DropAndPlug(1, eax); |
|
|
context()->DropAndPlug(1, eax); |
|
|
} else if (var != NULL && !var->is_this() && var->is_global()) { |
|
|
} else if (var != NULL && !var->is_this() && var->is_global()) { |
|
|
// Push global object as receiver for the call IC.
|
|
|
// Push global object as receiver for the call IC.
|
|
|
__ push(GlobalObjectOperand()); |
|
|
__ push(GlobalObjectOperand()); |
|
|
|
|
|
increment_stack_height(); |
|
|
EmitCallWithIC(expr, var->name(), RelocInfo::CODE_TARGET_CONTEXT); |
|
|
EmitCallWithIC(expr, var->name(), RelocInfo::CODE_TARGET_CONTEXT); |
|
|
} else if (var != NULL && var->AsSlot() != NULL && |
|
|
} else if (var != NULL && var->AsSlot() != NULL && |
|
|
var->AsSlot()->type() == Slot::LOOKUP) { |
|
|
var->AsSlot()->type() == Slot::LOOKUP) { |
|
@ -2170,7 +2237,9 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
|
|
__ push(Immediate(var->name())); |
|
|
__ push(Immediate(var->name())); |
|
|
__ CallRuntime(Runtime::kLoadContextSlot, 2); |
|
|
__ CallRuntime(Runtime::kLoadContextSlot, 2); |
|
|
__ push(eax); // Function.
|
|
|
__ push(eax); // Function.
|
|
|
|
|
|
increment_stack_height(); |
|
|
__ push(edx); // Receiver.
|
|
|
__ push(edx); // Receiver.
|
|
|
|
|
|
increment_stack_height(); |
|
|
|
|
|
|
|
|
// If fast case code has been generated, emit code to push the
|
|
|
// If fast case code has been generated, emit code to push the
|
|
|
// function and receiver and have the slow path jump around this
|
|
|
// function and receiver and have the slow path jump around this
|
|
@ -2179,7 +2248,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
|
|
Label call; |
|
|
Label call; |
|
|
__ jmp(&call); |
|
|
__ jmp(&call); |
|
|
__ bind(&done); |
|
|
__ bind(&done); |
|
|
// Push function.
|
|
|
// Push function. Stack height already incremented in slow case above.
|
|
|
__ push(eax); |
|
|
__ push(eax); |
|
|
// The receiver is implicitly the global receiver. Indicate this
|
|
|
// The receiver is implicitly the global receiver. Indicate this
|
|
|
// by passing the hole to the call function stub.
|
|
|
// by passing the hole to the call function stub.
|
|
@ -2225,9 +2294,11 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
|
|
__ call(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop)); |
|
|
__ call(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop)); |
|
|
// Push result (function).
|
|
|
// Push result (function).
|
|
|
__ push(eax); |
|
|
__ push(eax); |
|
|
|
|
|
increment_stack_height(); |
|
|
// Push Global receiver.
|
|
|
// Push Global receiver.
|
|
|
__ mov(ecx, GlobalObjectOperand()); |
|
|
__ mov(ecx, GlobalObjectOperand()); |
|
|
__ push(FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset)); |
|
|
__ push(FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset)); |
|
|
|
|
|
increment_stack_height(); |
|
|
EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS); |
|
|
EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS); |
|
|
} else { |
|
|
} else { |
|
|
{ PreservePositionScope scope(masm()->positions_recorder()); |
|
|
{ PreservePositionScope scope(masm()->positions_recorder()); |
|
@ -2243,6 +2314,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
|
|
// Load global receiver object.
|
|
|
// Load global receiver object.
|
|
|
__ mov(ebx, GlobalObjectOperand()); |
|
|
__ mov(ebx, GlobalObjectOperand()); |
|
|
__ push(FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset)); |
|
|
__ push(FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset)); |
|
|
|
|
|
increment_stack_height(); |
|
|
// Emit function call.
|
|
|
// Emit function call.
|
|
|
EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS); |
|
|
EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS); |
|
|
} |
|
|
} |
|
@ -2283,6 +2355,8 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
|
|
Handle<Code> construct_builtin = |
|
|
Handle<Code> construct_builtin = |
|
|
isolate()->builtins()->JSConstructCall(); |
|
|
isolate()->builtins()->JSConstructCall(); |
|
|
__ call(construct_builtin, RelocInfo::CONSTRUCT_CALL); |
|
|
__ call(construct_builtin, RelocInfo::CONSTRUCT_CALL); |
|
|
|
|
|
|
|
|
|
|
|
decrement_stack_height(arg_count + 1); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2595,6 +2669,7 @@ void FullCodeGenerator::EmitObjectEquals(ZoneList<Expression*>* args) { |
|
|
&if_true, &if_false, &fall_through); |
|
|
&if_true, &if_false, &fall_through); |
|
|
|
|
|
|
|
|
__ pop(ebx); |
|
|
__ pop(ebx); |
|
|
|
|
|
decrement_stack_height(); |
|
|
__ cmp(eax, Operand(ebx)); |
|
|
__ cmp(eax, Operand(ebx)); |
|
|
PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
|
|
PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
|
|
Split(equal, if_true, if_false, fall_through); |
|
|
Split(equal, if_true, if_false, fall_through); |
|
@ -2709,6 +2784,7 @@ void FullCodeGenerator::EmitLog(ZoneList<Expression*>* args) { |
|
|
VisitForStackValue(args->at(1)); |
|
|
VisitForStackValue(args->at(1)); |
|
|
VisitForStackValue(args->at(2)); |
|
|
VisitForStackValue(args->at(2)); |
|
|
__ CallRuntime(Runtime::kLog, 2); |
|
|
__ CallRuntime(Runtime::kLog, 2); |
|
|
|
|
|
decrement_stack_height(2); |
|
|
} |
|
|
} |
|
|
// Finally, we're expected to leave a value on the top of the stack.
|
|
|
// Finally, we're expected to leave a value on the top of the stack.
|
|
|
__ mov(eax, isolate()->factory()->undefined_value()); |
|
|
__ mov(eax, isolate()->factory()->undefined_value()); |
|
@ -2774,6 +2850,7 @@ void FullCodeGenerator::EmitSubString(ZoneList<Expression*>* args) { |
|
|
VisitForStackValue(args->at(1)); |
|
|
VisitForStackValue(args->at(1)); |
|
|
VisitForStackValue(args->at(2)); |
|
|
VisitForStackValue(args->at(2)); |
|
|
__ CallStub(&stub); |
|
|
__ CallStub(&stub); |
|
|
|
|
|
decrement_stack_height(3); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2787,6 +2864,7 @@ void FullCodeGenerator::EmitRegExpExec(ZoneList<Expression*>* args) { |
|
|
VisitForStackValue(args->at(2)); |
|
|
VisitForStackValue(args->at(2)); |
|
|
VisitForStackValue(args->at(3)); |
|
|
VisitForStackValue(args->at(3)); |
|
|
__ CallStub(&stub); |
|
|
__ CallStub(&stub); |
|
|
|
|
|
decrement_stack_height(4); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2821,6 +2899,7 @@ void FullCodeGenerator::EmitMathPow(ZoneList<Expression*>* args) { |
|
|
} else { |
|
|
} else { |
|
|
__ CallRuntime(Runtime::kMath_pow, 2); |
|
|
__ CallRuntime(Runtime::kMath_pow, 2); |
|
|
} |
|
|
} |
|
|
|
|
|
decrement_stack_height(2); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2831,6 +2910,7 @@ void FullCodeGenerator::EmitSetValueOf(ZoneList<Expression*>* args) { |
|
|
VisitForStackValue(args->at(0)); // Load the object.
|
|
|
VisitForStackValue(args->at(0)); // Load the object.
|
|
|
VisitForAccumulatorValue(args->at(1)); // Load the value.
|
|
|
VisitForAccumulatorValue(args->at(1)); // Load the value.
|
|
|
__ pop(ebx); // eax = value. ebx = object.
|
|
|
__ pop(ebx); // eax = value. ebx = object.
|
|
|
|
|
|
decrement_stack_height(); |
|
|
|
|
|
|
|
|
Label done; |
|
|
Label done; |
|
|
// If the object is a smi, return the value.
|
|
|
// If the object is a smi, return the value.
|
|
@ -2860,6 +2940,7 @@ void FullCodeGenerator::EmitNumberToString(ZoneList<Expression*>* args) { |
|
|
|
|
|
|
|
|
NumberToStringStub stub; |
|
|
NumberToStringStub stub; |
|
|
__ CallStub(&stub); |
|
|
__ CallStub(&stub); |
|
|
|
|
|
decrement_stack_height(); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2894,6 +2975,7 @@ void FullCodeGenerator::EmitStringCharCodeAt(ZoneList<Expression*>* args) { |
|
|
Register result = edx; |
|
|
Register result = edx; |
|
|
|
|
|
|
|
|
__ pop(object); |
|
|
__ pop(object); |
|
|
|
|
|
decrement_stack_height(); |
|
|
|
|
|
|
|
|
Label need_conversion; |
|
|
Label need_conversion; |
|
|
Label index_out_of_range; |
|
|
Label index_out_of_range; |
|
@ -2942,6 +3024,7 @@ void FullCodeGenerator::EmitStringCharAt(ZoneList<Expression*>* args) { |
|
|
Register result = eax; |
|
|
Register result = eax; |
|
|
|
|
|
|
|
|
__ pop(object); |
|
|
__ pop(object); |
|
|
|
|
|
decrement_stack_height(); |
|
|
|
|
|
|
|
|
Label need_conversion; |
|
|
Label need_conversion; |
|
|
Label index_out_of_range; |
|
|
Label index_out_of_range; |
|
@ -2986,6 +3069,7 @@ void FullCodeGenerator::EmitStringAdd(ZoneList<Expression*>* args) { |
|
|
|
|
|
|
|
|
StringAddStub stub(NO_STRING_ADD_FLAGS); |
|
|
StringAddStub stub(NO_STRING_ADD_FLAGS); |
|
|
__ CallStub(&stub); |
|
|
__ CallStub(&stub); |
|
|
|
|
|
decrement_stack_height(2); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2998,6 +3082,7 @@ void FullCodeGenerator::EmitStringCompare(ZoneList<Expression*>* args) { |
|
|
|
|
|
|
|
|
StringCompareStub stub; |
|
|
StringCompareStub stub; |
|
|
__ CallStub(&stub); |
|
|
__ CallStub(&stub); |
|
|
|
|
|
decrement_stack_height(2); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -3009,6 +3094,7 @@ void FullCodeGenerator::EmitMathSin(ZoneList<Expression*>* args) { |
|
|
ASSERT(args->length() == 1); |
|
|
ASSERT(args->length() == 1); |
|
|
VisitForStackValue(args->at(0)); |
|
|
VisitForStackValue(args->at(0)); |
|
|
__ CallStub(&stub); |
|
|
__ CallStub(&stub); |
|
|
|
|
|
decrement_stack_height(); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -3020,6 +3106,7 @@ void FullCodeGenerator::EmitMathCos(ZoneList<Expression*>* args) { |
|
|
ASSERT(args->length() == 1); |
|
|
ASSERT(args->length() == 1); |
|
|
VisitForStackValue(args->at(0)); |
|
|
VisitForStackValue(args->at(0)); |
|
|
__ CallStub(&stub); |
|
|
__ CallStub(&stub); |
|
|
|
|
|
decrement_stack_height(); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -3031,6 +3118,7 @@ void FullCodeGenerator::EmitMathLog(ZoneList<Expression*>* args) { |
|
|
ASSERT(args->length() == 1); |
|
|
ASSERT(args->length() == 1); |
|
|
VisitForStackValue(args->at(0)); |
|
|
VisitForStackValue(args->at(0)); |
|
|
__ CallStub(&stub); |
|
|
__ CallStub(&stub); |
|
|
|
|
|
decrement_stack_height(); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -3040,6 +3128,7 @@ void FullCodeGenerator::EmitMathSqrt(ZoneList<Expression*>* args) { |
|
|
ASSERT(args->length() == 1); |
|
|
ASSERT(args->length() == 1); |
|
|
VisitForStackValue(args->at(0)); |
|
|
VisitForStackValue(args->at(0)); |
|
|
__ CallRuntime(Runtime::kMath_sqrt, 1); |
|
|
__ CallRuntime(Runtime::kMath_sqrt, 1); |
|
|
|
|
|
decrement_stack_height(); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -3059,6 +3148,7 @@ void FullCodeGenerator::EmitCallFunction(ZoneList<Expression*>* args) { |
|
|
__ InvokeFunction(edi, count, CALL_FUNCTION, |
|
|
__ InvokeFunction(edi, count, CALL_FUNCTION, |
|
|
NullCallWrapper(), CALL_AS_METHOD); |
|
|
NullCallWrapper(), CALL_AS_METHOD); |
|
|
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
|
|
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
|
|
|
|
|
decrement_stack_height(arg_count + 1); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -3071,6 +3161,7 @@ void FullCodeGenerator::EmitRegExpConstructResult(ZoneList<Expression*>* args) { |
|
|
VisitForStackValue(args->at(1)); |
|
|
VisitForStackValue(args->at(1)); |
|
|
VisitForStackValue(args->at(2)); |
|
|
VisitForStackValue(args->at(2)); |
|
|
__ CallStub(&stub); |
|
|
__ CallStub(&stub); |
|
|
|
|
|
decrement_stack_height(3); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -3144,6 +3235,7 @@ void FullCodeGenerator::EmitSwapElements(ZoneList<Expression*>* args) { |
|
|
__ CallRuntime(Runtime::kSwapElements, 3); |
|
|
__ CallRuntime(Runtime::kSwapElements, 3); |
|
|
|
|
|
|
|
|
__ bind(&done); |
|
|
__ bind(&done); |
|
|
|
|
|
decrement_stack_height(3); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -3229,6 +3321,7 @@ void FullCodeGenerator::EmitIsRegExpEquivalent(ZoneList<Expression*>* args) { |
|
|
__ mov(eax, Immediate(isolate()->factory()->true_value())); |
|
|
__ mov(eax, Immediate(isolate()->factory()->true_value())); |
|
|
__ bind(&done); |
|
|
__ bind(&done); |
|
|
|
|
|
|
|
|
|
|
|
decrement_stack_height(); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -3532,6 +3625,7 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(ZoneList<Expression*>* args) { |
|
|
__ add(Operand(esp), Immediate(3 * kPointerSize)); |
|
|
__ add(Operand(esp), Immediate(3 * kPointerSize)); |
|
|
|
|
|
|
|
|
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
|
|
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
|
|
|
|
|
decrement_stack_height(); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -3584,6 +3678,7 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
|
|
// Prepare for calling JS runtime function.
|
|
|
// Prepare for calling JS runtime function.
|
|
|
__ mov(eax, GlobalObjectOperand()); |
|
|
__ mov(eax, GlobalObjectOperand()); |
|
|
__ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); |
|
|
__ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); |
|
|
|
|
|
increment_stack_height(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Push the arguments ("left-to-right").
|
|
|
// Push the arguments ("left-to-right").
|
|
@ -3606,6 +3701,11 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
|
|
// Call the C runtime function.
|
|
|
// Call the C runtime function.
|
|
|
__ CallRuntime(expr->function(), arg_count); |
|
|
__ CallRuntime(expr->function(), arg_count); |
|
|
} |
|
|
} |
|
|
|
|
|
decrement_stack_height(arg_count); |
|
|
|
|
|
if (expr->is_jsruntime()) { |
|
|
|
|
|
decrement_stack_height(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -3627,6 +3727,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
|
|
VisitForStackValue(prop->key()); |
|
|
VisitForStackValue(prop->key()); |
|
|
__ push(Immediate(Smi::FromInt(strict_mode_flag()))); |
|
|
__ push(Immediate(Smi::FromInt(strict_mode_flag()))); |
|
|
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); |
|
|
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); |
|
|
|
|
|
decrement_stack_height(2); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
} |
|
|
} |
|
|
} else if (var != NULL) { |
|
|
} else if (var != NULL) { |
|
@ -3696,6 +3797,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
|
|
VisitForTypeofValue(expr->expression()); |
|
|
VisitForTypeofValue(expr->expression()); |
|
|
} |
|
|
} |
|
|
__ CallRuntime(Runtime::kTypeof, 1); |
|
|
__ CallRuntime(Runtime::kTypeof, 1); |
|
|
|
|
|
decrement_stack_height(); |
|
|
context()->Plug(eax); |
|
|
context()->Plug(eax); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
@ -3750,7 +3852,10 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
|
|
// Invalid left-hand sides are rewritten to have a 'throw ReferenceError'
|
|
|
// Invalid left-hand sides are rewritten to have a 'throw ReferenceError'
|
|
|
// as the left-hand side.
|
|
|
// as the left-hand side.
|
|
|
if (!expr->expression()->IsValidLeftHandSide()) { |
|
|
if (!expr->expression()->IsValidLeftHandSide()) { |
|
|
VisitForEffect(expr->expression()); |
|
|
ASSERT(expr->expression()->AsThrow() != NULL); |
|
|
|
|
|
VisitInCurrentContext(expr->expression()); |
|
|
|
|
|
// Visiting Throw does not plug the context.
|
|
|
|
|
|
context()->Plug(eax); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -3775,17 +3880,20 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
|
|
// Reserve space for result of postfix operation.
|
|
|
// Reserve space for result of postfix operation.
|
|
|
if (expr->is_postfix() && !context()->IsEffect()) { |
|
|
if (expr->is_postfix() && !context()->IsEffect()) { |
|
|
__ push(Immediate(Smi::FromInt(0))); |
|
|
__ push(Immediate(Smi::FromInt(0))); |
|
|
|
|
|
increment_stack_height(); |
|
|
} |
|
|
} |
|
|
if (assign_type == NAMED_PROPERTY) { |
|
|
if (assign_type == NAMED_PROPERTY) { |
|
|
// Put the object both on the stack and in the accumulator.
|
|
|
// Put the object both on the stack and in the accumulator.
|
|
|
VisitForAccumulatorValue(prop->obj()); |
|
|
VisitForAccumulatorValue(prop->obj()); |
|
|
__ push(eax); |
|
|
__ push(eax); |
|
|
|
|
|
increment_stack_height(); |
|
|
EmitNamedPropertyLoad(prop); |
|
|
EmitNamedPropertyLoad(prop); |
|
|
} else { |
|
|
} else { |
|
|
VisitForStackValue(prop->obj()); |
|
|
VisitForStackValue(prop->obj()); |
|
|
VisitForAccumulatorValue(prop->key()); |
|
|
VisitForAccumulatorValue(prop->key()); |
|
|
__ mov(edx, Operand(esp, 0)); |
|
|
__ mov(edx, Operand(esp, 0)); |
|
|
__ push(eax); |
|
|
__ push(eax); |
|
|
|
|
|
increment_stack_height(); |
|
|
EmitKeyedPropertyLoad(prop); |
|
|
EmitKeyedPropertyLoad(prop); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -3816,6 +3924,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
|
|
switch (assign_type) { |
|
|
switch (assign_type) { |
|
|
case VARIABLE: |
|
|
case VARIABLE: |
|
|
__ push(eax); |
|
|
__ push(eax); |
|
|
|
|
|
increment_stack_height(); |
|
|
break; |
|
|
break; |
|
|
case NAMED_PROPERTY: |
|
|
case NAMED_PROPERTY: |
|
|
__ mov(Operand(esp, kPointerSize), eax); |
|
|
__ mov(Operand(esp, kPointerSize), eax); |
|
@ -3889,6 +3998,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
|
|
case NAMED_PROPERTY: { |
|
|
case NAMED_PROPERTY: { |
|
|
__ mov(ecx, prop->key()->AsLiteral()->handle()); |
|
|
__ mov(ecx, prop->key()->AsLiteral()->handle()); |
|
|
__ pop(edx); |
|
|
__ pop(edx); |
|
|
|
|
|
decrement_stack_height(); |
|
|
Handle<Code> ic = is_strict_mode() |
|
|
Handle<Code> ic = is_strict_mode() |
|
|
? isolate()->builtins()->StoreIC_Initialize_Strict() |
|
|
? isolate()->builtins()->StoreIC_Initialize_Strict() |
|
|
: isolate()->builtins()->StoreIC_Initialize(); |
|
|
: isolate()->builtins()->StoreIC_Initialize(); |
|
@ -3906,6 +4016,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
|
|
case KEYED_PROPERTY: { |
|
|
case KEYED_PROPERTY: { |
|
|
__ pop(ecx); |
|
|
__ pop(ecx); |
|
|
__ pop(edx); |
|
|
__ pop(edx); |
|
|
|
|
|
decrement_stack_height(); |
|
|
|
|
|
decrement_stack_height(); |
|
|
Handle<Code> ic = is_strict_mode() |
|
|
Handle<Code> ic = is_strict_mode() |
|
|
? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
|
|
? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
|
|
: isolate()->builtins()->KeyedStoreIC_Initialize(); |
|
|
: isolate()->builtins()->KeyedStoreIC_Initialize(); |
|
@ -4063,6 +4175,7 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { |
|
|
case Token::IN: |
|
|
case Token::IN: |
|
|
VisitForStackValue(expr->right()); |
|
|
VisitForStackValue(expr->right()); |
|
|
__ InvokeBuiltin(Builtins::IN, CALL_FUNCTION); |
|
|
__ InvokeBuiltin(Builtins::IN, CALL_FUNCTION); |
|
|
|
|
|
decrement_stack_height(2); |
|
|
PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); |
|
|
PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); |
|
|
__ cmp(eax, isolate()->factory()->true_value()); |
|
|
__ cmp(eax, isolate()->factory()->true_value()); |
|
|
Split(equal, if_true, if_false, fall_through); |
|
|
Split(equal, if_true, if_false, fall_through); |
|
@ -4072,6 +4185,7 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { |
|
|
VisitForStackValue(expr->right()); |
|
|
VisitForStackValue(expr->right()); |
|
|
InstanceofStub stub(InstanceofStub::kNoFlags); |
|
|
InstanceofStub stub(InstanceofStub::kNoFlags); |
|
|
__ CallStub(&stub); |
|
|
__ CallStub(&stub); |
|
|
|
|
|
decrement_stack_height(2); |
|
|
PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
|
|
PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
|
|
__ test(eax, Operand(eax)); |
|
|
__ test(eax, Operand(eax)); |
|
|
// The stub returns 0 for true.
|
|
|
// The stub returns 0 for true.
|
|
@ -4116,6 +4230,7 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { |
|
|
default: |
|
|
default: |
|
|
UNREACHABLE(); |
|
|
UNREACHABLE(); |
|
|
} |
|
|
} |
|
|
|
|
|
decrement_stack_height(); |
|
|
|
|
|
|
|
|
bool inline_smi_code = ShouldInlineSmiCase(op); |
|
|
bool inline_smi_code = ShouldInlineSmiCase(op); |
|
|
JumpPatchSite patch_site(masm_); |
|
|
JumpPatchSite patch_site(masm_); |
|
|