| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Possibly allocate a local context. | 161 // Possibly allocate a local context. |
| 162 if (info->scope()->num_heap_slots() > 0) { | 162 if (info->scope()->num_heap_slots() > 0) { |
| 163 Comment cmnt(masm_, "[ Allocate context"); | 163 Comment cmnt(masm_, "[ Allocate context"); |
| 164 bool need_write_barrier = true; | 164 bool need_write_barrier = true; |
| 165 int slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 165 int slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| 166 // Argument to NewContext is the function, which is still in edi. | 166 // Argument to NewContext is the function, which is still in edi. |
| 167 if (info->scope()->is_script_scope()) { | 167 if (info->scope()->is_script_scope()) { |
| 168 __ push(edi); | 168 __ push(edi); |
| 169 __ Push(info->scope()->GetScopeInfo(info->isolate())); | 169 __ Push(info->scope()->GetScopeInfo(info->isolate())); |
| 170 __ CallRuntime(Runtime::kNewScriptContext); | 170 __ CallRuntime(Runtime::kNewScriptContext); |
| 171 PrepareForBailoutForId(BailoutId::ScriptContext(), TOS_REG); | 171 PrepareForBailoutForId(BailoutId::ScriptContext(), |
| 172 Deoptimizer::BailoutState::TOS_REGISTER); |
| 172 // The new target value is not used, clobbering is safe. | 173 // The new target value is not used, clobbering is safe. |
| 173 DCHECK_NULL(info->scope()->new_target_var()); | 174 DCHECK_NULL(info->scope()->new_target_var()); |
| 174 } else { | 175 } else { |
| 175 if (info->scope()->new_target_var() != nullptr) { | 176 if (info->scope()->new_target_var() != nullptr) { |
| 176 __ push(edx); // Preserve new target. | 177 __ push(edx); // Preserve new target. |
| 177 } | 178 } |
| 178 if (slots <= FastNewContextStub::kMaximumSlots) { | 179 if (slots <= FastNewContextStub::kMaximumSlots) { |
| 179 FastNewContextStub stub(isolate(), slots); | 180 FastNewContextStub stub(isolate(), slots); |
| 180 __ CallStub(&stub); | 181 __ CallStub(&stub); |
| 181 // Result of FastNewContextStub is always in new space. | 182 // Result of FastNewContextStub is always in new space. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 __ Abort(kExpectedNewSpaceObject); | 221 __ Abort(kExpectedNewSpaceObject); |
| 221 __ bind(&done); | 222 __ bind(&done); |
| 222 } | 223 } |
| 223 } | 224 } |
| 224 } | 225 } |
| 225 } | 226 } |
| 226 | 227 |
| 227 // Register holding this function and new target are both trashed in case we | 228 // Register holding this function and new target are both trashed in case we |
| 228 // bailout here. But since that can happen only when new target is not used | 229 // bailout here. But since that can happen only when new target is not used |
| 229 // and we allocate a context, the value of |function_in_register| is correct. | 230 // and we allocate a context, the value of |function_in_register| is correct. |
| 230 PrepareForBailoutForId(BailoutId::FunctionContext(), NO_REGISTERS); | 231 PrepareForBailoutForId(BailoutId::FunctionContext(), |
| 232 Deoptimizer::BailoutState::NO_REGISTERS); |
| 231 | 233 |
| 232 // Possibly set up a local binding to the this function which is used in | 234 // Possibly set up a local binding to the this function which is used in |
| 233 // derived constructors with super calls. | 235 // derived constructors with super calls. |
| 234 Variable* this_function_var = scope()->this_function_var(); | 236 Variable* this_function_var = scope()->this_function_var(); |
| 235 if (this_function_var != nullptr) { | 237 if (this_function_var != nullptr) { |
| 236 Comment cmnt(masm_, "[ This function"); | 238 Comment cmnt(masm_, "[ This function"); |
| 237 if (!function_in_register) { | 239 if (!function_in_register) { |
| 238 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 240 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 239 // The write barrier clobbers register again, keep it marked as such. | 241 // The write barrier clobbers register again, keep it marked as such. |
| 240 } | 242 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 } | 284 } |
| 283 | 285 |
| 284 SetVar(arguments, eax, ebx, edx); | 286 SetVar(arguments, eax, ebx, edx); |
| 285 } | 287 } |
| 286 | 288 |
| 287 if (FLAG_trace) { | 289 if (FLAG_trace) { |
| 288 __ CallRuntime(Runtime::kTraceEnter); | 290 __ CallRuntime(Runtime::kTraceEnter); |
| 289 } | 291 } |
| 290 | 292 |
| 291 // Visit the declarations and body. | 293 // Visit the declarations and body. |
| 292 PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS); | 294 PrepareForBailoutForId(BailoutId::FunctionEntry(), |
| 295 Deoptimizer::BailoutState::NO_REGISTERS); |
| 293 { | 296 { |
| 294 Comment cmnt(masm_, "[ Declarations"); | 297 Comment cmnt(masm_, "[ Declarations"); |
| 295 VisitDeclarations(scope()->declarations()); | 298 VisitDeclarations(scope()->declarations()); |
| 296 } | 299 } |
| 297 | 300 |
| 298 // Assert that the declarations do not use ICs. Otherwise the debugger | 301 // Assert that the declarations do not use ICs. Otherwise the debugger |
| 299 // won't be able to redirect a PC at an IC to the correct IC in newly | 302 // won't be able to redirect a PC at an IC to the correct IC in newly |
| 300 // recompiled code. | 303 // recompiled code. |
| 301 DCHECK_EQ(0, ic_total_count_); | 304 DCHECK_EQ(0, ic_total_count_); |
| 302 | 305 |
| 303 { | 306 { |
| 304 Comment cmnt(masm_, "[ Stack check"); | 307 Comment cmnt(masm_, "[ Stack check"); |
| 305 PrepareForBailoutForId(BailoutId::Declarations(), NO_REGISTERS); | 308 PrepareForBailoutForId(BailoutId::Declarations(), |
| 309 Deoptimizer::BailoutState::NO_REGISTERS); |
| 306 Label ok; | 310 Label ok; |
| 307 ExternalReference stack_limit = | 311 ExternalReference stack_limit = |
| 308 ExternalReference::address_of_stack_limit(isolate()); | 312 ExternalReference::address_of_stack_limit(isolate()); |
| 309 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 313 __ cmp(esp, Operand::StaticVariable(stack_limit)); |
| 310 __ j(above_equal, &ok, Label::kNear); | 314 __ j(above_equal, &ok, Label::kNear); |
| 311 __ call(isolate()->builtins()->StackCheck(), RelocInfo::CODE_TARGET); | 315 __ call(isolate()->builtins()->StackCheck(), RelocInfo::CODE_TARGET); |
| 312 __ bind(&ok); | 316 __ bind(&ok); |
| 313 } | 317 } |
| 314 | 318 |
| 315 { | 319 { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 __ call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); | 366 __ call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); |
| 363 | 367 |
| 364 // Record a mapping of this PC offset to the OSR id. This is used to find | 368 // Record a mapping of this PC offset to the OSR id. This is used to find |
| 365 // the AST id from the unoptimized code in order to use it as a key into | 369 // the AST id from the unoptimized code in order to use it as a key into |
| 366 // the deoptimization input data found in the optimized code. | 370 // the deoptimization input data found in the optimized code. |
| 367 RecordBackEdge(stmt->OsrEntryId()); | 371 RecordBackEdge(stmt->OsrEntryId()); |
| 368 | 372 |
| 369 EmitProfilingCounterReset(); | 373 EmitProfilingCounterReset(); |
| 370 | 374 |
| 371 __ bind(&ok); | 375 __ bind(&ok); |
| 372 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); | 376 PrepareForBailoutForId(stmt->EntryId(), |
| 377 Deoptimizer::BailoutState::NO_REGISTERS); |
| 373 // Record a mapping of the OSR id to this PC. This is used if the OSR | 378 // Record a mapping of the OSR id to this PC. This is used if the OSR |
| 374 // entry becomes the target of a bailout. We don't expect it to be, but | 379 // entry becomes the target of a bailout. We don't expect it to be, but |
| 375 // we want it to work if it is. | 380 // we want it to work if it is. |
| 376 PrepareForBailoutForId(stmt->OsrEntryId(), NO_REGISTERS); | 381 PrepareForBailoutForId(stmt->OsrEntryId(), |
| 382 Deoptimizer::BailoutState::NO_REGISTERS); |
| 377 } | 383 } |
| 378 | 384 |
| 379 void FullCodeGenerator::EmitProfilingCounterHandlingForReturnSequence( | 385 void FullCodeGenerator::EmitProfilingCounterHandlingForReturnSequence( |
| 380 bool is_tail_call) { | 386 bool is_tail_call) { |
| 381 // Pretend that the exit is a backwards jump to the entry. | 387 // Pretend that the exit is a backwards jump to the entry. |
| 382 int weight = 1; | 388 int weight = 1; |
| 383 if (info_->ShouldSelfOptimize()) { | 389 if (info_->ShouldSelfOptimize()) { |
| 384 weight = FLAG_interrupt_budget / FLAG_self_opt_count; | 390 weight = FLAG_interrupt_budget / FLAG_self_opt_count; |
| 385 } else { | 391 } else { |
| 386 int distance = masm_->pc_offset(); | 392 int distance = masm_->pc_offset(); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 bool should_normalize, | 679 bool should_normalize, |
| 674 Label* if_true, | 680 Label* if_true, |
| 675 Label* if_false) { | 681 Label* if_false) { |
| 676 // Only prepare for bailouts before splits if we're in a test | 682 // Only prepare for bailouts before splits if we're in a test |
| 677 // context. Otherwise, we let the Visit function deal with the | 683 // context. Otherwise, we let the Visit function deal with the |
| 678 // preparation to avoid preparing with the same AST id twice. | 684 // preparation to avoid preparing with the same AST id twice. |
| 679 if (!context()->IsTest()) return; | 685 if (!context()->IsTest()) return; |
| 680 | 686 |
| 681 Label skip; | 687 Label skip; |
| 682 if (should_normalize) __ jmp(&skip, Label::kNear); | 688 if (should_normalize) __ jmp(&skip, Label::kNear); |
| 683 PrepareForBailout(expr, TOS_REG); | 689 PrepareForBailout(expr, Deoptimizer::BailoutState::TOS_REGISTER); |
| 684 if (should_normalize) { | 690 if (should_normalize) { |
| 685 __ cmp(eax, isolate()->factory()->true_value()); | 691 __ cmp(eax, isolate()->factory()->true_value()); |
| 686 Split(equal, if_true, if_false, NULL); | 692 Split(equal, if_true, if_false, NULL); |
| 687 __ bind(&skip); | 693 __ bind(&skip); |
| 688 } | 694 } |
| 689 } | 695 } |
| 690 | 696 |
| 691 | 697 |
| 692 void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { | 698 void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { |
| 693 // The variable in the declaration always resides in the current context. | 699 // The variable in the declaration always resides in the current context. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 } | 735 } |
| 730 break; | 736 break; |
| 731 | 737 |
| 732 case VariableLocation::CONTEXT: | 738 case VariableLocation::CONTEXT: |
| 733 if (hole_init) { | 739 if (hole_init) { |
| 734 Comment cmnt(masm_, "[ VariableDeclaration"); | 740 Comment cmnt(masm_, "[ VariableDeclaration"); |
| 735 EmitDebugCheckDeclarationContext(variable); | 741 EmitDebugCheckDeclarationContext(variable); |
| 736 __ mov(ContextOperand(esi, variable->index()), | 742 __ mov(ContextOperand(esi, variable->index()), |
| 737 Immediate(isolate()->factory()->the_hole_value())); | 743 Immediate(isolate()->factory()->the_hole_value())); |
| 738 // No write barrier since the hole value is in old space. | 744 // No write barrier since the hole value is in old space. |
| 739 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); | 745 PrepareForBailoutForId(proxy->id(), |
| 746 Deoptimizer::BailoutState::NO_REGISTERS); |
| 740 } | 747 } |
| 741 break; | 748 break; |
| 742 | 749 |
| 743 case VariableLocation::LOOKUP: { | 750 case VariableLocation::LOOKUP: { |
| 744 Comment cmnt(masm_, "[ VariableDeclaration"); | 751 Comment cmnt(masm_, "[ VariableDeclaration"); |
| 745 __ push(Immediate(variable->name())); | 752 __ push(Immediate(variable->name())); |
| 746 // VariableDeclaration nodes are always introduced in one of four modes. | 753 // VariableDeclaration nodes are always introduced in one of four modes. |
| 747 DCHECK(IsDeclaredVariableMode(mode)); | 754 DCHECK(IsDeclaredVariableMode(mode)); |
| 748 // Push initial value, if any. | 755 // Push initial value, if any. |
| 749 // Note: For variables we must not push an initial value (such as | 756 // Note: For variables we must not push an initial value (such as |
| 750 // 'undefined') because we may have a (legal) redeclaration and we | 757 // 'undefined') because we may have a (legal) redeclaration and we |
| 751 // must not destroy the current value. | 758 // must not destroy the current value. |
| 752 if (hole_init) { | 759 if (hole_init) { |
| 753 __ push(Immediate(isolate()->factory()->the_hole_value())); | 760 __ push(Immediate(isolate()->factory()->the_hole_value())); |
| 754 } else { | 761 } else { |
| 755 __ push(Immediate(Smi::FromInt(0))); // Indicates no initial value. | 762 __ push(Immediate(Smi::FromInt(0))); // Indicates no initial value. |
| 756 } | 763 } |
| 757 __ push( | 764 __ push( |
| 758 Immediate(Smi::FromInt(variable->DeclarationPropertyAttributes()))); | 765 Immediate(Smi::FromInt(variable->DeclarationPropertyAttributes()))); |
| 759 __ CallRuntime(Runtime::kDeclareLookupSlot); | 766 __ CallRuntime(Runtime::kDeclareLookupSlot); |
| 760 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); | 767 PrepareForBailoutForId(proxy->id(), |
| 768 Deoptimizer::BailoutState::NO_REGISTERS); |
| 761 break; | 769 break; |
| 762 } | 770 } |
| 763 } | 771 } |
| 764 } | 772 } |
| 765 | 773 |
| 766 | 774 |
| 767 void FullCodeGenerator::VisitFunctionDeclaration( | 775 void FullCodeGenerator::VisitFunctionDeclaration( |
| 768 FunctionDeclaration* declaration) { | 776 FunctionDeclaration* declaration) { |
| 769 VariableProxy* proxy = declaration->proxy(); | 777 VariableProxy* proxy = declaration->proxy(); |
| 770 Variable* variable = proxy->var(); | 778 Variable* variable = proxy->var(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 794 VisitForAccumulatorValue(declaration->fun()); | 802 VisitForAccumulatorValue(declaration->fun()); |
| 795 __ mov(ContextOperand(esi, variable->index()), result_register()); | 803 __ mov(ContextOperand(esi, variable->index()), result_register()); |
| 796 // We know that we have written a function, which is not a smi. | 804 // We know that we have written a function, which is not a smi. |
| 797 __ RecordWriteContextSlot(esi, | 805 __ RecordWriteContextSlot(esi, |
| 798 Context::SlotOffset(variable->index()), | 806 Context::SlotOffset(variable->index()), |
| 799 result_register(), | 807 result_register(), |
| 800 ecx, | 808 ecx, |
| 801 kDontSaveFPRegs, | 809 kDontSaveFPRegs, |
| 802 EMIT_REMEMBERED_SET, | 810 EMIT_REMEMBERED_SET, |
| 803 OMIT_SMI_CHECK); | 811 OMIT_SMI_CHECK); |
| 804 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); | 812 PrepareForBailoutForId(proxy->id(), |
| 813 Deoptimizer::BailoutState::NO_REGISTERS); |
| 805 break; | 814 break; |
| 806 } | 815 } |
| 807 | 816 |
| 808 case VariableLocation::LOOKUP: { | 817 case VariableLocation::LOOKUP: { |
| 809 Comment cmnt(masm_, "[ FunctionDeclaration"); | 818 Comment cmnt(masm_, "[ FunctionDeclaration"); |
| 810 PushOperand(variable->name()); | 819 PushOperand(variable->name()); |
| 811 VisitForStackValue(declaration->fun()); | 820 VisitForStackValue(declaration->fun()); |
| 812 PushOperand(Smi::FromInt(variable->DeclarationPropertyAttributes())); | 821 PushOperand(Smi::FromInt(variable->DeclarationPropertyAttributes())); |
| 813 CallRuntimeWithOperands(Runtime::kDeclareLookupSlot); | 822 CallRuntimeWithOperands(Runtime::kDeclareLookupSlot); |
| 814 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); | 823 PrepareForBailoutForId(proxy->id(), |
| 824 Deoptimizer::BailoutState::NO_REGISTERS); |
| 815 break; | 825 break; |
| 816 } | 826 } |
| 817 } | 827 } |
| 818 } | 828 } |
| 819 | 829 |
| 820 | 830 |
| 821 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 831 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
| 822 // Call the runtime to declare the globals. | 832 // Call the runtime to declare the globals. |
| 823 __ Push(pairs); | 833 __ Push(pairs); |
| 824 __ Push(Smi::FromInt(DeclareGlobalsFlags())); | 834 __ Push(Smi::FromInt(DeclareGlobalsFlags())); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 835 } | 845 } |
| 836 | 846 |
| 837 | 847 |
| 838 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { | 848 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { |
| 839 Comment cmnt(masm_, "[ SwitchStatement"); | 849 Comment cmnt(masm_, "[ SwitchStatement"); |
| 840 Breakable nested_statement(this, stmt); | 850 Breakable nested_statement(this, stmt); |
| 841 SetStatementPosition(stmt); | 851 SetStatementPosition(stmt); |
| 842 | 852 |
| 843 // Keep the switch value on the stack until a case matches. | 853 // Keep the switch value on the stack until a case matches. |
| 844 VisitForStackValue(stmt->tag()); | 854 VisitForStackValue(stmt->tag()); |
| 845 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); | 855 PrepareForBailoutForId(stmt->EntryId(), |
| 856 Deoptimizer::BailoutState::NO_REGISTERS); |
| 846 | 857 |
| 847 ZoneList<CaseClause*>* clauses = stmt->cases(); | 858 ZoneList<CaseClause*>* clauses = stmt->cases(); |
| 848 CaseClause* default_clause = NULL; // Can occur anywhere in the list. | 859 CaseClause* default_clause = NULL; // Can occur anywhere in the list. |
| 849 | 860 |
| 850 Label next_test; // Recycled for each test. | 861 Label next_test; // Recycled for each test. |
| 851 // Compile all the tests with branches to their bodies. | 862 // Compile all the tests with branches to their bodies. |
| 852 for (int i = 0; i < clauses->length(); i++) { | 863 for (int i = 0; i < clauses->length(); i++) { |
| 853 CaseClause* clause = clauses->at(i); | 864 CaseClause* clause = clauses->at(i); |
| 854 clause->body_target()->Unuse(); | 865 clause->body_target()->Unuse(); |
| 855 | 866 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 884 } | 895 } |
| 885 | 896 |
| 886 SetExpressionPosition(clause); | 897 SetExpressionPosition(clause); |
| 887 Handle<Code> ic = | 898 Handle<Code> ic = |
| 888 CodeFactory::CompareIC(isolate(), Token::EQ_STRICT).code(); | 899 CodeFactory::CompareIC(isolate(), Token::EQ_STRICT).code(); |
| 889 CallIC(ic, clause->CompareId()); | 900 CallIC(ic, clause->CompareId()); |
| 890 patch_site.EmitPatchInfo(); | 901 patch_site.EmitPatchInfo(); |
| 891 | 902 |
| 892 Label skip; | 903 Label skip; |
| 893 __ jmp(&skip, Label::kNear); | 904 __ jmp(&skip, Label::kNear); |
| 894 PrepareForBailout(clause, TOS_REG); | 905 PrepareForBailout(clause, Deoptimizer::BailoutState::TOS_REGISTER); |
| 895 __ cmp(eax, isolate()->factory()->true_value()); | 906 __ cmp(eax, isolate()->factory()->true_value()); |
| 896 __ j(not_equal, &next_test); | 907 __ j(not_equal, &next_test); |
| 897 __ Drop(1); | 908 __ Drop(1); |
| 898 __ jmp(clause->body_target()); | 909 __ jmp(clause->body_target()); |
| 899 __ bind(&skip); | 910 __ bind(&skip); |
| 900 | 911 |
| 901 __ test(eax, eax); | 912 __ test(eax, eax); |
| 902 __ j(not_equal, &next_test); | 913 __ j(not_equal, &next_test); |
| 903 __ Drop(1); // Switch value is no longer needed. | 914 __ Drop(1); // Switch value is no longer needed. |
| 904 __ jmp(clause->body_target()); | 915 __ jmp(clause->body_target()); |
| 905 } | 916 } |
| 906 | 917 |
| 907 // Discard the test value and jump to the default if present, otherwise to | 918 // Discard the test value and jump to the default if present, otherwise to |
| 908 // the end of the statement. | 919 // the end of the statement. |
| 909 __ bind(&next_test); | 920 __ bind(&next_test); |
| 910 DropOperands(1); // Switch value is no longer needed. | 921 DropOperands(1); // Switch value is no longer needed. |
| 911 if (default_clause == NULL) { | 922 if (default_clause == NULL) { |
| 912 __ jmp(nested_statement.break_label()); | 923 __ jmp(nested_statement.break_label()); |
| 913 } else { | 924 } else { |
| 914 __ jmp(default_clause->body_target()); | 925 __ jmp(default_clause->body_target()); |
| 915 } | 926 } |
| 916 | 927 |
| 917 // Compile all the case bodies. | 928 // Compile all the case bodies. |
| 918 for (int i = 0; i < clauses->length(); i++) { | 929 for (int i = 0; i < clauses->length(); i++) { |
| 919 Comment cmnt(masm_, "[ Case body"); | 930 Comment cmnt(masm_, "[ Case body"); |
| 920 CaseClause* clause = clauses->at(i); | 931 CaseClause* clause = clauses->at(i); |
| 921 __ bind(clause->body_target()); | 932 __ bind(clause->body_target()); |
| 922 PrepareForBailoutForId(clause->EntryId(), NO_REGISTERS); | 933 PrepareForBailoutForId(clause->EntryId(), |
| 934 Deoptimizer::BailoutState::NO_REGISTERS); |
| 923 VisitStatements(clause->statements()); | 935 VisitStatements(clause->statements()); |
| 924 } | 936 } |
| 925 | 937 |
| 926 __ bind(nested_statement.break_label()); | 938 __ bind(nested_statement.break_label()); |
| 927 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 939 PrepareForBailoutForId(stmt->ExitId(), |
| 940 Deoptimizer::BailoutState::NO_REGISTERS); |
| 928 } | 941 } |
| 929 | 942 |
| 930 | 943 |
| 931 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 944 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
| 932 Comment cmnt(masm_, "[ ForInStatement"); | 945 Comment cmnt(masm_, "[ ForInStatement"); |
| 933 SetStatementPosition(stmt, SKIP_BREAK); | 946 SetStatementPosition(stmt, SKIP_BREAK); |
| 934 | 947 |
| 935 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); | 948 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); |
| 936 | 949 |
| 937 // Get the object to enumerate over. | 950 // Get the object to enumerate over. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 950 __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, ecx); | 963 __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, ecx); |
| 951 __ j(above_equal, &done_convert, Label::kNear); | 964 __ j(above_equal, &done_convert, Label::kNear); |
| 952 __ cmp(eax, isolate()->factory()->undefined_value()); | 965 __ cmp(eax, isolate()->factory()->undefined_value()); |
| 953 __ j(equal, &exit); | 966 __ j(equal, &exit); |
| 954 __ cmp(eax, isolate()->factory()->null_value()); | 967 __ cmp(eax, isolate()->factory()->null_value()); |
| 955 __ j(equal, &exit); | 968 __ j(equal, &exit); |
| 956 __ bind(&convert); | 969 __ bind(&convert); |
| 957 ToObjectStub stub(isolate()); | 970 ToObjectStub stub(isolate()); |
| 958 __ CallStub(&stub); | 971 __ CallStub(&stub); |
| 959 __ bind(&done_convert); | 972 __ bind(&done_convert); |
| 960 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); | 973 PrepareForBailoutForId(stmt->ToObjectId(), |
| 974 Deoptimizer::BailoutState::TOS_REGISTER); |
| 961 __ push(eax); | 975 __ push(eax); |
| 962 | 976 |
| 963 // Check cache validity in generated code. If we cannot guarantee cache | 977 // Check cache validity in generated code. If we cannot guarantee cache |
| 964 // validity, call the runtime system to check cache validity or get the | 978 // validity, call the runtime system to check cache validity or get the |
| 965 // property names in a fixed array. Note: Proxies never have an enum cache, | 979 // property names in a fixed array. Note: Proxies never have an enum cache, |
| 966 // so will always take the slow path. | 980 // so will always take the slow path. |
| 967 Label call_runtime, use_cache, fixed_array; | 981 Label call_runtime, use_cache, fixed_array; |
| 968 __ CheckEnumCache(&call_runtime); | 982 __ CheckEnumCache(&call_runtime); |
| 969 | 983 |
| 970 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); | 984 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); |
| 971 __ jmp(&use_cache, Label::kNear); | 985 __ jmp(&use_cache, Label::kNear); |
| 972 | 986 |
| 973 // Get the set of properties to enumerate. | 987 // Get the set of properties to enumerate. |
| 974 __ bind(&call_runtime); | 988 __ bind(&call_runtime); |
| 975 __ push(eax); | 989 __ push(eax); |
| 976 __ CallRuntime(Runtime::kForInEnumerate); | 990 __ CallRuntime(Runtime::kForInEnumerate); |
| 977 PrepareForBailoutForId(stmt->EnumId(), TOS_REG); | 991 PrepareForBailoutForId(stmt->EnumId(), |
| 992 Deoptimizer::BailoutState::TOS_REGISTER); |
| 978 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), | 993 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), |
| 979 isolate()->factory()->meta_map()); | 994 isolate()->factory()->meta_map()); |
| 980 __ j(not_equal, &fixed_array); | 995 __ j(not_equal, &fixed_array); |
| 981 | 996 |
| 982 | 997 |
| 983 // We got a map in register eax. Get the enumeration cache from it. | 998 // We got a map in register eax. Get the enumeration cache from it. |
| 984 Label no_descriptors; | 999 Label no_descriptors; |
| 985 __ bind(&use_cache); | 1000 __ bind(&use_cache); |
| 986 | 1001 |
| 987 __ EnumLength(edx, eax); | 1002 __ EnumLength(edx, eax); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1003 __ add(esp, Immediate(kPointerSize)); | 1018 __ add(esp, Immediate(kPointerSize)); |
| 1004 __ jmp(&exit); | 1019 __ jmp(&exit); |
| 1005 | 1020 |
| 1006 // We got a fixed array in register eax. Iterate through that. | 1021 // We got a fixed array in register eax. Iterate through that. |
| 1007 __ bind(&fixed_array); | 1022 __ bind(&fixed_array); |
| 1008 | 1023 |
| 1009 __ push(Immediate(Smi::FromInt(1))); // Smi(1) indicates slow check | 1024 __ push(Immediate(Smi::FromInt(1))); // Smi(1) indicates slow check |
| 1010 __ push(eax); // Array | 1025 __ push(eax); // Array |
| 1011 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); | 1026 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); |
| 1012 __ push(eax); // Fixed array length (as smi). | 1027 __ push(eax); // Fixed array length (as smi). |
| 1013 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS); | 1028 PrepareForBailoutForId(stmt->PrepareId(), |
| 1029 Deoptimizer::BailoutState::NO_REGISTERS); |
| 1014 __ push(Immediate(Smi::FromInt(0))); // Initial index. | 1030 __ push(Immediate(Smi::FromInt(0))); // Initial index. |
| 1015 | 1031 |
| 1016 // Generate code for doing the condition check. | 1032 // Generate code for doing the condition check. |
| 1017 __ bind(&loop); | 1033 __ bind(&loop); |
| 1018 SetExpressionAsStatementPosition(stmt->each()); | 1034 SetExpressionAsStatementPosition(stmt->each()); |
| 1019 | 1035 |
| 1020 __ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index. | 1036 __ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index. |
| 1021 __ cmp(eax, Operand(esp, 1 * kPointerSize)); // Compare to the array length. | 1037 __ cmp(eax, Operand(esp, 1 * kPointerSize)); // Compare to the array length. |
| 1022 __ j(above_equal, loop_statement.break_label()); | 1038 __ j(above_equal, loop_statement.break_label()); |
| 1023 | 1039 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1041 __ EmitLoadTypeFeedbackVector(edx); | 1057 __ EmitLoadTypeFeedbackVector(edx); |
| 1042 __ mov(FieldOperand(edx, FixedArray::OffsetOfElementAt(vector_index)), | 1058 __ mov(FieldOperand(edx, FixedArray::OffsetOfElementAt(vector_index)), |
| 1043 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 1059 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
| 1044 | 1060 |
| 1045 // Convert the entry to a string or null if it isn't a property | 1061 // Convert the entry to a string or null if it isn't a property |
| 1046 // anymore. If the property has been removed while iterating, we | 1062 // anymore. If the property has been removed while iterating, we |
| 1047 // just skip it. | 1063 // just skip it. |
| 1048 __ push(ecx); // Enumerable. | 1064 __ push(ecx); // Enumerable. |
| 1049 __ push(ebx); // Current entry. | 1065 __ push(ebx); // Current entry. |
| 1050 __ CallRuntime(Runtime::kForInFilter); | 1066 __ CallRuntime(Runtime::kForInFilter); |
| 1051 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); | 1067 PrepareForBailoutForId(stmt->FilterId(), |
| 1068 Deoptimizer::BailoutState::TOS_REGISTER); |
| 1052 __ cmp(eax, isolate()->factory()->undefined_value()); | 1069 __ cmp(eax, isolate()->factory()->undefined_value()); |
| 1053 __ j(equal, loop_statement.continue_label()); | 1070 __ j(equal, loop_statement.continue_label()); |
| 1054 __ mov(ebx, eax); | 1071 __ mov(ebx, eax); |
| 1055 | 1072 |
| 1056 // Update the 'each' property or variable from the possibly filtered | 1073 // Update the 'each' property or variable from the possibly filtered |
| 1057 // entry in register ebx. | 1074 // entry in register ebx. |
| 1058 __ bind(&update_each); | 1075 __ bind(&update_each); |
| 1059 __ mov(result_register(), ebx); | 1076 __ mov(result_register(), ebx); |
| 1060 // Perform the assignment as if via '='. | 1077 // Perform the assignment as if via '='. |
| 1061 { EffectContext context(this); | 1078 { EffectContext context(this); |
| 1062 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); | 1079 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); |
| 1063 PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS); | 1080 PrepareForBailoutForId(stmt->AssignmentId(), |
| 1081 Deoptimizer::BailoutState::NO_REGISTERS); |
| 1064 } | 1082 } |
| 1065 | 1083 |
| 1066 // Both Crankshaft and Turbofan expect BodyId to be right before stmt->body(). | 1084 // Both Crankshaft and Turbofan expect BodyId to be right before stmt->body(). |
| 1067 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); | 1085 PrepareForBailoutForId(stmt->BodyId(), |
| 1086 Deoptimizer::BailoutState::NO_REGISTERS); |
| 1068 // Generate code for the body of the loop. | 1087 // Generate code for the body of the loop. |
| 1069 Visit(stmt->body()); | 1088 Visit(stmt->body()); |
| 1070 | 1089 |
| 1071 // Generate code for going to the next element by incrementing the | 1090 // Generate code for going to the next element by incrementing the |
| 1072 // index (smi) stored on top of the stack. | 1091 // index (smi) stored on top of the stack. |
| 1073 __ bind(loop_statement.continue_label()); | 1092 __ bind(loop_statement.continue_label()); |
| 1074 __ add(Operand(esp, 0 * kPointerSize), Immediate(Smi::FromInt(1))); | 1093 __ add(Operand(esp, 0 * kPointerSize), Immediate(Smi::FromInt(1))); |
| 1075 | 1094 |
| 1076 EmitBackEdgeBookkeeping(stmt, &loop); | 1095 EmitBackEdgeBookkeeping(stmt, &loop); |
| 1077 __ jmp(&loop); | 1096 __ jmp(&loop); |
| 1078 | 1097 |
| 1079 // Remove the pointers stored on the stack. | 1098 // Remove the pointers stored on the stack. |
| 1080 __ bind(loop_statement.break_label()); | 1099 __ bind(loop_statement.break_label()); |
| 1081 DropOperands(5); | 1100 DropOperands(5); |
| 1082 | 1101 |
| 1083 // Exit and decrement the loop depth. | 1102 // Exit and decrement the loop depth. |
| 1084 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1103 PrepareForBailoutForId(stmt->ExitId(), |
| 1104 Deoptimizer::BailoutState::NO_REGISTERS); |
| 1085 __ bind(&exit); | 1105 __ bind(&exit); |
| 1086 decrement_loop_depth(); | 1106 decrement_loop_depth(); |
| 1087 } | 1107 } |
| 1088 | 1108 |
| 1089 | 1109 |
| 1090 void FullCodeGenerator::EmitSetHomeObject(Expression* initializer, int offset, | 1110 void FullCodeGenerator::EmitSetHomeObject(Expression* initializer, int offset, |
| 1091 FeedbackVectorSlot slot) { | 1111 FeedbackVectorSlot slot) { |
| 1092 DCHECK(NeedsHomeObject(initializer)); | 1112 DCHECK(NeedsHomeObject(initializer)); |
| 1093 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); | 1113 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); |
| 1094 __ mov(StoreDescriptor::NameRegister(), | 1114 __ mov(StoreDescriptor::NameRegister(), |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 __ mov(LoadDescriptor::NameRegister(), var->name()); | 1252 __ mov(LoadDescriptor::NameRegister(), var->name()); |
| 1233 __ mov(LoadDescriptor::SlotRegister(), | 1253 __ mov(LoadDescriptor::SlotRegister(), |
| 1234 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 1254 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
| 1235 CallLoadIC(typeof_mode); | 1255 CallLoadIC(typeof_mode); |
| 1236 } | 1256 } |
| 1237 | 1257 |
| 1238 | 1258 |
| 1239 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, | 1259 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, |
| 1240 TypeofMode typeof_mode) { | 1260 TypeofMode typeof_mode) { |
| 1241 SetExpressionPosition(proxy); | 1261 SetExpressionPosition(proxy); |
| 1242 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); | 1262 PrepareForBailoutForId(proxy->BeforeId(), |
| 1263 Deoptimizer::BailoutState::NO_REGISTERS); |
| 1243 Variable* var = proxy->var(); | 1264 Variable* var = proxy->var(); |
| 1244 | 1265 |
| 1245 // Three cases: global variables, lookup variables, and all other types of | 1266 // Three cases: global variables, lookup variables, and all other types of |
| 1246 // variables. | 1267 // variables. |
| 1247 switch (var->location()) { | 1268 switch (var->location()) { |
| 1248 case VariableLocation::GLOBAL: | 1269 case VariableLocation::GLOBAL: |
| 1249 case VariableLocation::UNALLOCATED: { | 1270 case VariableLocation::UNALLOCATED: { |
| 1250 Comment cmnt(masm_, "[ Global variable"); | 1271 Comment cmnt(masm_, "[ Global variable"); |
| 1251 EmitGlobalVariableLoad(proxy, typeof_mode); | 1272 EmitGlobalVariableLoad(proxy, typeof_mode); |
| 1252 context()->Plug(eax); | 1273 context()->Plug(eax); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 __ CallRuntime(Runtime::kCreateObjectLiteral); | 1365 __ CallRuntime(Runtime::kCreateObjectLiteral); |
| 1345 } else { | 1366 } else { |
| 1346 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1367 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1347 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); | 1368 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); |
| 1348 __ mov(ecx, Immediate(constant_properties)); | 1369 __ mov(ecx, Immediate(constant_properties)); |
| 1349 __ mov(edx, Immediate(Smi::FromInt(flags))); | 1370 __ mov(edx, Immediate(Smi::FromInt(flags))); |
| 1350 FastCloneShallowObjectStub stub(isolate(), expr->properties_count()); | 1371 FastCloneShallowObjectStub stub(isolate(), expr->properties_count()); |
| 1351 __ CallStub(&stub); | 1372 __ CallStub(&stub); |
| 1352 RestoreContext(); | 1373 RestoreContext(); |
| 1353 } | 1374 } |
| 1354 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); | 1375 PrepareForBailoutForId(expr->CreateLiteralId(), |
| 1376 Deoptimizer::BailoutState::TOS_REGISTER); |
| 1355 | 1377 |
| 1356 // If result_saved is true the result is on top of the stack. If | 1378 // If result_saved is true the result is on top of the stack. If |
| 1357 // result_saved is false the result is in eax. | 1379 // result_saved is false the result is in eax. |
| 1358 bool result_saved = false; | 1380 bool result_saved = false; |
| 1359 | 1381 |
| 1360 AccessorTable accessor_table(zone()); | 1382 AccessorTable accessor_table(zone()); |
| 1361 int property_index = 0; | 1383 int property_index = 0; |
| 1362 for (; property_index < expr->properties()->length(); property_index++) { | 1384 for (; property_index < expr->properties()->length(); property_index++) { |
| 1363 ObjectLiteral::Property* property = expr->properties()->at(property_index); | 1385 ObjectLiteral::Property* property = expr->properties()->at(property_index); |
| 1364 if (property->is_computed_name()) break; | 1386 if (property->is_computed_name()) break; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1380 // It is safe to use [[Put]] here because the boilerplate already | 1402 // It is safe to use [[Put]] here because the boilerplate already |
| 1381 // contains computed properties with an uninitialized value. | 1403 // contains computed properties with an uninitialized value. |
| 1382 if (key->value()->IsInternalizedString()) { | 1404 if (key->value()->IsInternalizedString()) { |
| 1383 if (property->emit_store()) { | 1405 if (property->emit_store()) { |
| 1384 VisitForAccumulatorValue(value); | 1406 VisitForAccumulatorValue(value); |
| 1385 DCHECK(StoreDescriptor::ValueRegister().is(eax)); | 1407 DCHECK(StoreDescriptor::ValueRegister().is(eax)); |
| 1386 __ mov(StoreDescriptor::NameRegister(), Immediate(key->value())); | 1408 __ mov(StoreDescriptor::NameRegister(), Immediate(key->value())); |
| 1387 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); | 1409 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); |
| 1388 EmitLoadStoreICSlot(property->GetSlot(0)); | 1410 EmitLoadStoreICSlot(property->GetSlot(0)); |
| 1389 CallStoreIC(); | 1411 CallStoreIC(); |
| 1390 PrepareForBailoutForId(key->id(), NO_REGISTERS); | 1412 PrepareForBailoutForId(key->id(), |
| 1413 Deoptimizer::BailoutState::NO_REGISTERS); |
| 1391 if (NeedsHomeObject(value)) { | 1414 if (NeedsHomeObject(value)) { |
| 1392 EmitSetHomeObjectAccumulator(value, 0, property->GetSlot(1)); | 1415 EmitSetHomeObjectAccumulator(value, 0, property->GetSlot(1)); |
| 1393 } | 1416 } |
| 1394 } else { | 1417 } else { |
| 1395 VisitForEffect(value); | 1418 VisitForEffect(value); |
| 1396 } | 1419 } |
| 1397 break; | 1420 break; |
| 1398 } | 1421 } |
| 1399 PushOperand(Operand(esp, 0)); // Duplicate receiver. | 1422 PushOperand(Operand(esp, 0)); // Duplicate receiver. |
| 1400 VisitForStackValue(key); | 1423 VisitForStackValue(key); |
| 1401 VisitForStackValue(value); | 1424 VisitForStackValue(value); |
| 1402 if (property->emit_store()) { | 1425 if (property->emit_store()) { |
| 1403 if (NeedsHomeObject(value)) { | 1426 if (NeedsHomeObject(value)) { |
| 1404 EmitSetHomeObject(value, 2, property->GetSlot()); | 1427 EmitSetHomeObject(value, 2, property->GetSlot()); |
| 1405 } | 1428 } |
| 1406 PushOperand(Smi::FromInt(SLOPPY)); // Language mode | 1429 PushOperand(Smi::FromInt(SLOPPY)); // Language mode |
| 1407 CallRuntimeWithOperands(Runtime::kSetProperty); | 1430 CallRuntimeWithOperands(Runtime::kSetProperty); |
| 1408 } else { | 1431 } else { |
| 1409 DropOperands(3); | 1432 DropOperands(3); |
| 1410 } | 1433 } |
| 1411 break; | 1434 break; |
| 1412 case ObjectLiteral::Property::PROTOTYPE: | 1435 case ObjectLiteral::Property::PROTOTYPE: |
| 1413 PushOperand(Operand(esp, 0)); // Duplicate receiver. | 1436 PushOperand(Operand(esp, 0)); // Duplicate receiver. |
| 1414 VisitForStackValue(value); | 1437 VisitForStackValue(value); |
| 1415 DCHECK(property->emit_store()); | 1438 DCHECK(property->emit_store()); |
| 1416 CallRuntimeWithOperands(Runtime::kInternalSetPrototype); | 1439 CallRuntimeWithOperands(Runtime::kInternalSetPrototype); |
| 1417 PrepareForBailoutForId(expr->GetIdForPropertySet(property_index), | 1440 PrepareForBailoutForId(expr->GetIdForPropertySet(property_index), |
| 1418 NO_REGISTERS); | 1441 Deoptimizer::BailoutState::NO_REGISTERS); |
| 1419 break; | 1442 break; |
| 1420 case ObjectLiteral::Property::GETTER: | 1443 case ObjectLiteral::Property::GETTER: |
| 1421 if (property->emit_store()) { | 1444 if (property->emit_store()) { |
| 1422 accessor_table.lookup(key)->second->getter = property; | 1445 accessor_table.lookup(key)->second->getter = property; |
| 1423 } | 1446 } |
| 1424 break; | 1447 break; |
| 1425 case ObjectLiteral::Property::SETTER: | 1448 case ObjectLiteral::Property::SETTER: |
| 1426 if (property->emit_store()) { | 1449 if (property->emit_store()) { |
| 1427 accessor_table.lookup(key)->second->setter = property; | 1450 accessor_table.lookup(key)->second->setter = property; |
| 1428 } | 1451 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 } | 1487 } |
| 1465 | 1488 |
| 1466 PushOperand(Operand(esp, 0)); // Duplicate receiver. | 1489 PushOperand(Operand(esp, 0)); // Duplicate receiver. |
| 1467 | 1490 |
| 1468 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) { | 1491 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) { |
| 1469 DCHECK(!property->is_computed_name()); | 1492 DCHECK(!property->is_computed_name()); |
| 1470 VisitForStackValue(value); | 1493 VisitForStackValue(value); |
| 1471 DCHECK(property->emit_store()); | 1494 DCHECK(property->emit_store()); |
| 1472 CallRuntimeWithOperands(Runtime::kInternalSetPrototype); | 1495 CallRuntimeWithOperands(Runtime::kInternalSetPrototype); |
| 1473 PrepareForBailoutForId(expr->GetIdForPropertySet(property_index), | 1496 PrepareForBailoutForId(expr->GetIdForPropertySet(property_index), |
| 1474 NO_REGISTERS); | 1497 Deoptimizer::BailoutState::NO_REGISTERS); |
| 1475 } else { | 1498 } else { |
| 1476 EmitPropertyKey(property, expr->GetIdForPropertyName(property_index)); | 1499 EmitPropertyKey(property, expr->GetIdForPropertyName(property_index)); |
| 1477 VisitForStackValue(value); | 1500 VisitForStackValue(value); |
| 1478 if (NeedsHomeObject(value)) { | 1501 if (NeedsHomeObject(value)) { |
| 1479 EmitSetHomeObject(value, 2, property->GetSlot()); | 1502 EmitSetHomeObject(value, 2, property->GetSlot()); |
| 1480 } | 1503 } |
| 1481 | 1504 |
| 1482 switch (property->kind()) { | 1505 switch (property->kind()) { |
| 1483 case ObjectLiteral::Property::CONSTANT: | 1506 case ObjectLiteral::Property::CONSTANT: |
| 1484 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1507 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1537 __ push(Immediate(constant_elements)); | 1560 __ push(Immediate(constant_elements)); |
| 1538 __ push(Immediate(Smi::FromInt(expr->ComputeFlags()))); | 1561 __ push(Immediate(Smi::FromInt(expr->ComputeFlags()))); |
| 1539 __ CallRuntime(Runtime::kCreateArrayLiteral); | 1562 __ CallRuntime(Runtime::kCreateArrayLiteral); |
| 1540 } else { | 1563 } else { |
| 1541 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1564 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1542 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); | 1565 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); |
| 1543 __ mov(ecx, Immediate(constant_elements)); | 1566 __ mov(ecx, Immediate(constant_elements)); |
| 1544 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); | 1567 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); |
| 1545 __ CallStub(&stub); | 1568 __ CallStub(&stub); |
| 1546 } | 1569 } |
| 1547 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); | 1570 PrepareForBailoutForId(expr->CreateLiteralId(), |
| 1571 Deoptimizer::BailoutState::TOS_REGISTER); |
| 1548 | 1572 |
| 1549 bool result_saved = false; // Is the result saved to the stack? | 1573 bool result_saved = false; // Is the result saved to the stack? |
| 1550 ZoneList<Expression*>* subexprs = expr->values(); | 1574 ZoneList<Expression*>* subexprs = expr->values(); |
| 1551 int length = subexprs->length(); | 1575 int length = subexprs->length(); |
| 1552 | 1576 |
| 1553 // Emit code to evaluate all the non-constant subexpressions and to store | 1577 // Emit code to evaluate all the non-constant subexpressions and to store |
| 1554 // them into the newly cloned array. | 1578 // them into the newly cloned array. |
| 1555 int array_index = 0; | 1579 int array_index = 0; |
| 1556 for (; array_index < length; array_index++) { | 1580 for (; array_index < length; array_index++) { |
| 1557 Expression* subexpr = subexprs->at(array_index); | 1581 Expression* subexpr = subexprs->at(array_index); |
| 1558 DCHECK(!subexpr->IsSpread()); | 1582 DCHECK(!subexpr->IsSpread()); |
| 1559 | 1583 |
| 1560 // If the subexpression is a literal or a simple materialized literal it | 1584 // If the subexpression is a literal or a simple materialized literal it |
| 1561 // is already set in the cloned array. | 1585 // is already set in the cloned array. |
| 1562 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; | 1586 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
| 1563 | 1587 |
| 1564 if (!result_saved) { | 1588 if (!result_saved) { |
| 1565 PushOperand(eax); // array literal. | 1589 PushOperand(eax); // array literal. |
| 1566 result_saved = true; | 1590 result_saved = true; |
| 1567 } | 1591 } |
| 1568 VisitForAccumulatorValue(subexpr); | 1592 VisitForAccumulatorValue(subexpr); |
| 1569 | 1593 |
| 1570 __ mov(StoreDescriptor::NameRegister(), | 1594 __ mov(StoreDescriptor::NameRegister(), |
| 1571 Immediate(Smi::FromInt(array_index))); | 1595 Immediate(Smi::FromInt(array_index))); |
| 1572 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); | 1596 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); |
| 1573 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); | 1597 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); |
| 1574 Handle<Code> ic = | 1598 Handle<Code> ic = |
| 1575 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | 1599 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); |
| 1576 CallIC(ic); | 1600 CallIC(ic); |
| 1577 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); | 1601 PrepareForBailoutForId(expr->GetIdForElement(array_index), |
| 1602 Deoptimizer::BailoutState::NO_REGISTERS); |
| 1578 } | 1603 } |
| 1579 | 1604 |
| 1580 // In case the array literal contains spread expressions it has two parts. The | 1605 // In case the array literal contains spread expressions it has two parts. The |
| 1581 // first part is the "static" array which has a literal index is handled | 1606 // first part is the "static" array which has a literal index is handled |
| 1582 // above. The second part is the part after the first spread expression | 1607 // above. The second part is the part after the first spread expression |
| 1583 // (inclusive) and these elements gets appended to the array. Note that the | 1608 // (inclusive) and these elements gets appended to the array. Note that the |
| 1584 // number elements an iterable produces is unknown ahead of time. | 1609 // number elements an iterable produces is unknown ahead of time. |
| 1585 if (array_index < length && result_saved) { | 1610 if (array_index < length && result_saved) { |
| 1586 PopOperand(eax); | 1611 PopOperand(eax); |
| 1587 result_saved = false; | 1612 result_saved = false; |
| 1588 } | 1613 } |
| 1589 for (; array_index < length; array_index++) { | 1614 for (; array_index < length; array_index++) { |
| 1590 Expression* subexpr = subexprs->at(array_index); | 1615 Expression* subexpr = subexprs->at(array_index); |
| 1591 | 1616 |
| 1592 PushOperand(eax); | 1617 PushOperand(eax); |
| 1593 DCHECK(!subexpr->IsSpread()); | 1618 DCHECK(!subexpr->IsSpread()); |
| 1594 VisitForStackValue(subexpr); | 1619 VisitForStackValue(subexpr); |
| 1595 CallRuntimeWithOperands(Runtime::kAppendElement); | 1620 CallRuntimeWithOperands(Runtime::kAppendElement); |
| 1596 | 1621 |
| 1597 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); | 1622 PrepareForBailoutForId(expr->GetIdForElement(array_index), |
| 1623 Deoptimizer::BailoutState::NO_REGISTERS); |
| 1598 } | 1624 } |
| 1599 | 1625 |
| 1600 if (result_saved) { | 1626 if (result_saved) { |
| 1601 context()->PlugTOS(); | 1627 context()->PlugTOS(); |
| 1602 } else { | 1628 } else { |
| 1603 context()->Plug(eax); | 1629 context()->Plug(eax); |
| 1604 } | 1630 } |
| 1605 } | 1631 } |
| 1606 | 1632 |
| 1607 | 1633 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1666 } | 1692 } |
| 1667 | 1693 |
| 1668 // For compound assignments we need another deoptimization point after the | 1694 // For compound assignments we need another deoptimization point after the |
| 1669 // variable/property load. | 1695 // variable/property load. |
| 1670 if (expr->is_compound()) { | 1696 if (expr->is_compound()) { |
| 1671 AccumulatorValueContext result_context(this); | 1697 AccumulatorValueContext result_context(this); |
| 1672 { AccumulatorValueContext left_operand_context(this); | 1698 { AccumulatorValueContext left_operand_context(this); |
| 1673 switch (assign_type) { | 1699 switch (assign_type) { |
| 1674 case VARIABLE: | 1700 case VARIABLE: |
| 1675 EmitVariableLoad(expr->target()->AsVariableProxy()); | 1701 EmitVariableLoad(expr->target()->AsVariableProxy()); |
| 1676 PrepareForBailout(expr->target(), TOS_REG); | 1702 PrepareForBailout(expr->target(), |
| 1703 Deoptimizer::BailoutState::TOS_REGISTER); |
| 1677 break; | 1704 break; |
| 1678 case NAMED_SUPER_PROPERTY: | 1705 case NAMED_SUPER_PROPERTY: |
| 1679 EmitNamedSuperPropertyLoad(property); | 1706 EmitNamedSuperPropertyLoad(property); |
| 1680 PrepareForBailoutForId(property->LoadId(), TOS_REG); | 1707 PrepareForBailoutForId(property->LoadId(), |
| 1708 Deoptimizer::BailoutState::TOS_REGISTER); |
| 1681 break; | 1709 break; |
| 1682 case NAMED_PROPERTY: | 1710 case NAMED_PROPERTY: |
| 1683 EmitNamedPropertyLoad(property); | 1711 EmitNamedPropertyLoad(property); |
| 1684 PrepareForBailoutForId(property->LoadId(), TOS_REG); | 1712 PrepareForBailoutForId(property->LoadId(), |
| 1713 Deoptimizer::BailoutState::TOS_REGISTER); |
| 1685 break; | 1714 break; |
| 1686 case KEYED_SUPER_PROPERTY: | 1715 case KEYED_SUPER_PROPERTY: |
| 1687 EmitKeyedSuperPropertyLoad(property); | 1716 EmitKeyedSuperPropertyLoad(property); |
| 1688 PrepareForBailoutForId(property->LoadId(), TOS_REG); | 1717 PrepareForBailoutForId(property->LoadId(), |
| 1718 Deoptimizer::BailoutState::TOS_REGISTER); |
| 1689 break; | 1719 break; |
| 1690 case KEYED_PROPERTY: | 1720 case KEYED_PROPERTY: |
| 1691 EmitKeyedPropertyLoad(property); | 1721 EmitKeyedPropertyLoad(property); |
| 1692 PrepareForBailoutForId(property->LoadId(), TOS_REG); | 1722 PrepareForBailoutForId(property->LoadId(), |
| 1723 Deoptimizer::BailoutState::TOS_REGISTER); |
| 1693 break; | 1724 break; |
| 1694 } | 1725 } |
| 1695 } | 1726 } |
| 1696 | 1727 |
| 1697 Token::Value op = expr->binary_op(); | 1728 Token::Value op = expr->binary_op(); |
| 1698 PushOperand(eax); // Left operand goes on the stack. | 1729 PushOperand(eax); // Left operand goes on the stack. |
| 1699 VisitForAccumulatorValue(expr->value()); | 1730 VisitForAccumulatorValue(expr->value()); |
| 1700 | 1731 |
| 1701 if (ShouldInlineSmiCase(op)) { | 1732 if (ShouldInlineSmiCase(op)) { |
| 1702 EmitInlineSmiBinaryOp(expr->binary_operation(), | 1733 EmitInlineSmiBinaryOp(expr->binary_operation(), |
| 1703 op, | 1734 op, |
| 1704 expr->target(), | 1735 expr->target(), |
| 1705 expr->value()); | 1736 expr->value()); |
| 1706 } else { | 1737 } else { |
| 1707 EmitBinaryOp(expr->binary_operation(), op); | 1738 EmitBinaryOp(expr->binary_operation(), op); |
| 1708 } | 1739 } |
| 1709 | 1740 |
| 1710 // Deoptimization point in case the binary operation may have side effects. | 1741 // Deoptimization point in case the binary operation may have side effects. |
| 1711 PrepareForBailout(expr->binary_operation(), TOS_REG); | 1742 PrepareForBailout(expr->binary_operation(), |
| 1743 Deoptimizer::BailoutState::TOS_REGISTER); |
| 1712 } else { | 1744 } else { |
| 1713 VisitForAccumulatorValue(expr->value()); | 1745 VisitForAccumulatorValue(expr->value()); |
| 1714 } | 1746 } |
| 1715 | 1747 |
| 1716 SetExpressionPosition(expr); | 1748 SetExpressionPosition(expr); |
| 1717 | 1749 |
| 1718 // Store the value. | 1750 // Store the value. |
| 1719 switch (assign_type) { | 1751 switch (assign_type) { |
| 1720 case VARIABLE: | 1752 case VARIABLE: |
| 1721 EmitVariableAssignment(expr->target()->AsVariableProxy()->var(), | 1753 EmitVariableAssignment(expr->target()->AsVariableProxy()->var(), |
| 1722 expr->op(), expr->AssignmentSlot()); | 1754 expr->op(), expr->AssignmentSlot()); |
| 1723 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 1755 PrepareForBailoutForId(expr->AssignmentId(), |
| 1756 Deoptimizer::BailoutState::TOS_REGISTER); |
| 1724 context()->Plug(eax); | 1757 context()->Plug(eax); |
| 1725 break; | 1758 break; |
| 1726 case NAMED_PROPERTY: | 1759 case NAMED_PROPERTY: |
| 1727 EmitNamedPropertyAssignment(expr); | 1760 EmitNamedPropertyAssignment(expr); |
| 1728 break; | 1761 break; |
| 1729 case NAMED_SUPER_PROPERTY: | 1762 case NAMED_SUPER_PROPERTY: |
| 1730 EmitNamedSuperPropertyStore(property); | 1763 EmitNamedSuperPropertyStore(property); |
| 1731 context()->Plug(result_register()); | 1764 context()->Plug(result_register()); |
| 1732 break; | 1765 break; |
| 1733 case KEYED_SUPER_PROPERTY: | 1766 case KEYED_SUPER_PROPERTY: |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2172 // eax : value | 2205 // eax : value |
| 2173 // esp[0] : receiver | 2206 // esp[0] : receiver |
| 2174 Property* prop = expr->target()->AsProperty(); | 2207 Property* prop = expr->target()->AsProperty(); |
| 2175 DCHECK(prop != NULL); | 2208 DCHECK(prop != NULL); |
| 2176 DCHECK(prop->key()->IsLiteral()); | 2209 DCHECK(prop->key()->IsLiteral()); |
| 2177 | 2210 |
| 2178 __ mov(StoreDescriptor::NameRegister(), prop->key()->AsLiteral()->value()); | 2211 __ mov(StoreDescriptor::NameRegister(), prop->key()->AsLiteral()->value()); |
| 2179 PopOperand(StoreDescriptor::ReceiverRegister()); | 2212 PopOperand(StoreDescriptor::ReceiverRegister()); |
| 2180 EmitLoadStoreICSlot(expr->AssignmentSlot()); | 2213 EmitLoadStoreICSlot(expr->AssignmentSlot()); |
| 2181 CallStoreIC(); | 2214 CallStoreIC(); |
| 2182 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2215 PrepareForBailoutForId(expr->AssignmentId(), |
| 2216 Deoptimizer::BailoutState::TOS_REGISTER); |
| 2183 context()->Plug(eax); | 2217 context()->Plug(eax); |
| 2184 } | 2218 } |
| 2185 | 2219 |
| 2186 | 2220 |
| 2187 void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) { | 2221 void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) { |
| 2188 // Assignment to named property of super. | 2222 // Assignment to named property of super. |
| 2189 // eax : value | 2223 // eax : value |
| 2190 // stack : receiver ('this'), home_object | 2224 // stack : receiver ('this'), home_object |
| 2191 DCHECK(prop != NULL); | 2225 DCHECK(prop != NULL); |
| 2192 Literal* key = prop->key()->AsLiteral(); | 2226 Literal* key = prop->key()->AsLiteral(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2218 // esp[0] : key | 2252 // esp[0] : key |
| 2219 // esp[kPointerSize] : receiver | 2253 // esp[kPointerSize] : receiver |
| 2220 | 2254 |
| 2221 PopOperand(StoreDescriptor::NameRegister()); // Key. | 2255 PopOperand(StoreDescriptor::NameRegister()); // Key. |
| 2222 PopOperand(StoreDescriptor::ReceiverRegister()); | 2256 PopOperand(StoreDescriptor::ReceiverRegister()); |
| 2223 DCHECK(StoreDescriptor::ValueRegister().is(eax)); | 2257 DCHECK(StoreDescriptor::ValueRegister().is(eax)); |
| 2224 Handle<Code> ic = | 2258 Handle<Code> ic = |
| 2225 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | 2259 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); |
| 2226 EmitLoadStoreICSlot(expr->AssignmentSlot()); | 2260 EmitLoadStoreICSlot(expr->AssignmentSlot()); |
| 2227 CallIC(ic); | 2261 CallIC(ic); |
| 2228 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2262 PrepareForBailoutForId(expr->AssignmentId(), |
| 2263 Deoptimizer::BailoutState::TOS_REGISTER); |
| 2229 context()->Plug(eax); | 2264 context()->Plug(eax); |
| 2230 } | 2265 } |
| 2231 | 2266 |
| 2232 | 2267 |
| 2233 void FullCodeGenerator::CallIC(Handle<Code> code, | 2268 void FullCodeGenerator::CallIC(Handle<Code> code, |
| 2234 TypeFeedbackId ast_id) { | 2269 TypeFeedbackId ast_id) { |
| 2235 ic_total_count_++; | 2270 ic_total_count_++; |
| 2236 __ call(code, RelocInfo::CODE_TARGET, ast_id); | 2271 __ call(code, RelocInfo::CODE_TARGET, ast_id); |
| 2237 } | 2272 } |
| 2238 | 2273 |
| 2239 | 2274 |
| 2240 // Code common for calls using the IC. | 2275 // Code common for calls using the IC. |
| 2241 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { | 2276 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { |
| 2242 Expression* callee = expr->expression(); | 2277 Expression* callee = expr->expression(); |
| 2243 | 2278 |
| 2244 // Get the target function. | 2279 // Get the target function. |
| 2245 ConvertReceiverMode convert_mode; | 2280 ConvertReceiverMode convert_mode; |
| 2246 if (callee->IsVariableProxy()) { | 2281 if (callee->IsVariableProxy()) { |
| 2247 { StackValueContext context(this); | 2282 { StackValueContext context(this); |
| 2248 EmitVariableLoad(callee->AsVariableProxy()); | 2283 EmitVariableLoad(callee->AsVariableProxy()); |
| 2249 PrepareForBailout(callee, NO_REGISTERS); | 2284 PrepareForBailout(callee, Deoptimizer::BailoutState::NO_REGISTERS); |
| 2250 } | 2285 } |
| 2251 // Push undefined as receiver. This is patched in the method prologue if it | 2286 // Push undefined as receiver. This is patched in the method prologue if it |
| 2252 // is a sloppy mode method. | 2287 // is a sloppy mode method. |
| 2253 PushOperand(isolate()->factory()->undefined_value()); | 2288 PushOperand(isolate()->factory()->undefined_value()); |
| 2254 convert_mode = ConvertReceiverMode::kNullOrUndefined; | 2289 convert_mode = ConvertReceiverMode::kNullOrUndefined; |
| 2255 } else { | 2290 } else { |
| 2256 // Load the function from the receiver. | 2291 // Load the function from the receiver. |
| 2257 DCHECK(callee->IsProperty()); | 2292 DCHECK(callee->IsProperty()); |
| 2258 DCHECK(!callee->AsProperty()->IsSuperAccess()); | 2293 DCHECK(!callee->AsProperty()->IsSuperAccess()); |
| 2259 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); | 2294 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); |
| 2260 EmitNamedPropertyLoad(callee->AsProperty()); | 2295 EmitNamedPropertyLoad(callee->AsProperty()); |
| 2261 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); | 2296 PrepareForBailoutForId(callee->AsProperty()->LoadId(), |
| 2297 Deoptimizer::BailoutState::TOS_REGISTER); |
| 2262 // Push the target function under the receiver. | 2298 // Push the target function under the receiver. |
| 2263 PushOperand(Operand(esp, 0)); | 2299 PushOperand(Operand(esp, 0)); |
| 2264 __ mov(Operand(esp, kPointerSize), eax); | 2300 __ mov(Operand(esp, kPointerSize), eax); |
| 2265 convert_mode = ConvertReceiverMode::kNotNullOrUndefined; | 2301 convert_mode = ConvertReceiverMode::kNotNullOrUndefined; |
| 2266 } | 2302 } |
| 2267 | 2303 |
| 2268 EmitCall(expr, convert_mode); | 2304 EmitCall(expr, convert_mode); |
| 2269 } | 2305 } |
| 2270 | 2306 |
| 2271 | 2307 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2286 PushOperand(eax); | 2322 PushOperand(eax); |
| 2287 PushOperand(Operand(esp, kPointerSize * 2)); | 2323 PushOperand(Operand(esp, kPointerSize * 2)); |
| 2288 PushOperand(key->value()); | 2324 PushOperand(key->value()); |
| 2289 // Stack here: | 2325 // Stack here: |
| 2290 // - home_object | 2326 // - home_object |
| 2291 // - this (receiver) | 2327 // - this (receiver) |
| 2292 // - this (receiver) <-- LoadFromSuper will pop here and below. | 2328 // - this (receiver) <-- LoadFromSuper will pop here and below. |
| 2293 // - home_object | 2329 // - home_object |
| 2294 // - key | 2330 // - key |
| 2295 CallRuntimeWithOperands(Runtime::kLoadFromSuper); | 2331 CallRuntimeWithOperands(Runtime::kLoadFromSuper); |
| 2296 PrepareForBailoutForId(prop->LoadId(), TOS_REG); | 2332 PrepareForBailoutForId(prop->LoadId(), |
| 2333 Deoptimizer::BailoutState::TOS_REGISTER); |
| 2297 | 2334 |
| 2298 // Replace home_object with target function. | 2335 // Replace home_object with target function. |
| 2299 __ mov(Operand(esp, kPointerSize), eax); | 2336 __ mov(Operand(esp, kPointerSize), eax); |
| 2300 | 2337 |
| 2301 // Stack here: | 2338 // Stack here: |
| 2302 // - target function | 2339 // - target function |
| 2303 // - this (receiver) | 2340 // - this (receiver) |
| 2304 EmitCall(expr); | 2341 EmitCall(expr); |
| 2305 } | 2342 } |
| 2306 | 2343 |
| 2307 | 2344 |
| 2308 // Code common for calls using the IC. | 2345 // Code common for calls using the IC. |
| 2309 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, | 2346 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, |
| 2310 Expression* key) { | 2347 Expression* key) { |
| 2311 // Load the key. | 2348 // Load the key. |
| 2312 VisitForAccumulatorValue(key); | 2349 VisitForAccumulatorValue(key); |
| 2313 | 2350 |
| 2314 Expression* callee = expr->expression(); | 2351 Expression* callee = expr->expression(); |
| 2315 | 2352 |
| 2316 // Load the function from the receiver. | 2353 // Load the function from the receiver. |
| 2317 DCHECK(callee->IsProperty()); | 2354 DCHECK(callee->IsProperty()); |
| 2318 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); | 2355 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); |
| 2319 __ mov(LoadDescriptor::NameRegister(), eax); | 2356 __ mov(LoadDescriptor::NameRegister(), eax); |
| 2320 EmitKeyedPropertyLoad(callee->AsProperty()); | 2357 EmitKeyedPropertyLoad(callee->AsProperty()); |
| 2321 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); | 2358 PrepareForBailoutForId(callee->AsProperty()->LoadId(), |
| 2359 Deoptimizer::BailoutState::TOS_REGISTER); |
| 2322 | 2360 |
| 2323 // Push the target function under the receiver. | 2361 // Push the target function under the receiver. |
| 2324 PushOperand(Operand(esp, 0)); | 2362 PushOperand(Operand(esp, 0)); |
| 2325 __ mov(Operand(esp, kPointerSize), eax); | 2363 __ mov(Operand(esp, kPointerSize), eax); |
| 2326 | 2364 |
| 2327 EmitCall(expr, ConvertReceiverMode::kNotNullOrUndefined); | 2365 EmitCall(expr, ConvertReceiverMode::kNotNullOrUndefined); |
| 2328 } | 2366 } |
| 2329 | 2367 |
| 2330 | 2368 |
| 2331 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { | 2369 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2343 PushOperand(eax); | 2381 PushOperand(eax); |
| 2344 PushOperand(Operand(esp, kPointerSize * 2)); | 2382 PushOperand(Operand(esp, kPointerSize * 2)); |
| 2345 VisitForStackValue(prop->key()); | 2383 VisitForStackValue(prop->key()); |
| 2346 // Stack here: | 2384 // Stack here: |
| 2347 // - home_object | 2385 // - home_object |
| 2348 // - this (receiver) | 2386 // - this (receiver) |
| 2349 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | 2387 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
| 2350 // - home_object | 2388 // - home_object |
| 2351 // - key | 2389 // - key |
| 2352 CallRuntimeWithOperands(Runtime::kLoadKeyedFromSuper); | 2390 CallRuntimeWithOperands(Runtime::kLoadKeyedFromSuper); |
| 2353 PrepareForBailoutForId(prop->LoadId(), TOS_REG); | 2391 PrepareForBailoutForId(prop->LoadId(), |
| 2392 Deoptimizer::BailoutState::TOS_REGISTER); |
| 2354 | 2393 |
| 2355 // Replace home_object with target function. | 2394 // Replace home_object with target function. |
| 2356 __ mov(Operand(esp, kPointerSize), eax); | 2395 __ mov(Operand(esp, kPointerSize), eax); |
| 2357 | 2396 |
| 2358 // Stack here: | 2397 // Stack here: |
| 2359 // - target function | 2398 // - target function |
| 2360 // - this (receiver) | 2399 // - this (receiver) |
| 2361 EmitCall(expr); | 2400 EmitCall(expr); |
| 2362 } | 2401 } |
| 2363 | 2402 |
| 2364 | 2403 |
| 2365 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { | 2404 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { |
| 2366 // Load the arguments. | 2405 // Load the arguments. |
| 2367 ZoneList<Expression*>* args = expr->arguments(); | 2406 ZoneList<Expression*>* args = expr->arguments(); |
| 2368 int arg_count = args->length(); | 2407 int arg_count = args->length(); |
| 2369 for (int i = 0; i < arg_count; i++) { | 2408 for (int i = 0; i < arg_count; i++) { |
| 2370 VisitForStackValue(args->at(i)); | 2409 VisitForStackValue(args->at(i)); |
| 2371 } | 2410 } |
| 2372 | 2411 |
| 2373 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | 2412 PrepareForBailoutForId(expr->CallId(), |
| 2413 Deoptimizer::BailoutState::NO_REGISTERS); |
| 2374 SetCallPosition(expr, expr->tail_call_mode()); | 2414 SetCallPosition(expr, expr->tail_call_mode()); |
| 2375 if (expr->tail_call_mode() == TailCallMode::kAllow) { | 2415 if (expr->tail_call_mode() == TailCallMode::kAllow) { |
| 2376 if (FLAG_trace) { | 2416 if (FLAG_trace) { |
| 2377 __ CallRuntime(Runtime::kTraceTailCall); | 2417 __ CallRuntime(Runtime::kTraceTailCall); |
| 2378 } | 2418 } |
| 2379 // Update profiling counters before the tail call since we will | 2419 // Update profiling counters before the tail call since we will |
| 2380 // not return to this function. | 2420 // not return to this function. |
| 2381 EmitProfilingCounterHandlingForReturnSequence(true); | 2421 EmitProfilingCounterHandlingForReturnSequence(true); |
| 2382 } | 2422 } |
| 2383 Handle<Code> ic = | 2423 Handle<Code> ic = |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2431 // eval-introduced variables. | 2471 // eval-introduced variables. |
| 2432 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); | 2472 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); |
| 2433 | 2473 |
| 2434 __ bind(&slow); | 2474 __ bind(&slow); |
| 2435 // Call the runtime to find the function to call (returned in eax) and | 2475 // Call the runtime to find the function to call (returned in eax) and |
| 2436 // the object holding it (returned in edx). | 2476 // the object holding it (returned in edx). |
| 2437 __ Push(callee->name()); | 2477 __ Push(callee->name()); |
| 2438 __ CallRuntime(Runtime::kLoadLookupSlotForCall); | 2478 __ CallRuntime(Runtime::kLoadLookupSlotForCall); |
| 2439 PushOperand(eax); // Function. | 2479 PushOperand(eax); // Function. |
| 2440 PushOperand(edx); // Receiver. | 2480 PushOperand(edx); // Receiver. |
| 2441 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS); | 2481 PrepareForBailoutForId(expr->LookupId(), |
| 2482 Deoptimizer::BailoutState::NO_REGISTERS); |
| 2442 | 2483 |
| 2443 // If fast case code has been generated, emit code to push the function | 2484 // If fast case code has been generated, emit code to push the function |
| 2444 // and receiver and have the slow path jump around this code. | 2485 // and receiver and have the slow path jump around this code. |
| 2445 if (done.is_linked()) { | 2486 if (done.is_linked()) { |
| 2446 Label call; | 2487 Label call; |
| 2447 __ jmp(&call, Label::kNear); | 2488 __ jmp(&call, Label::kNear); |
| 2448 __ bind(&done); | 2489 __ bind(&done); |
| 2449 // Push function. | 2490 // Push function. |
| 2450 __ push(eax); | 2491 __ push(eax); |
| 2451 // The receiver is implicitly the global receiver. Indicate this by | 2492 // The receiver is implicitly the global receiver. Indicate this by |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2476 } | 2517 } |
| 2477 | 2518 |
| 2478 // Push a copy of the function (found below the arguments) and | 2519 // Push a copy of the function (found below the arguments) and |
| 2479 // resolve eval. | 2520 // resolve eval. |
| 2480 __ push(Operand(esp, (arg_count + 1) * kPointerSize)); | 2521 __ push(Operand(esp, (arg_count + 1) * kPointerSize)); |
| 2481 EmitResolvePossiblyDirectEval(expr); | 2522 EmitResolvePossiblyDirectEval(expr); |
| 2482 | 2523 |
| 2483 // Touch up the stack with the resolved function. | 2524 // Touch up the stack with the resolved function. |
| 2484 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax); | 2525 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax); |
| 2485 | 2526 |
| 2486 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2527 PrepareForBailoutForId(expr->EvalId(), |
| 2528 Deoptimizer::BailoutState::NO_REGISTERS); |
| 2487 | 2529 |
| 2488 SetCallPosition(expr); | 2530 SetCallPosition(expr); |
| 2489 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 2531 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
| 2490 __ Set(eax, arg_count); | 2532 __ Set(eax, arg_count); |
| 2491 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 2533 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
| 2492 expr->tail_call_mode()), | 2534 expr->tail_call_mode()), |
| 2493 RelocInfo::CODE_TARGET); | 2535 RelocInfo::CODE_TARGET); |
| 2494 OperandStackDepthDecrement(arg_count + 1); | 2536 OperandStackDepthDecrement(arg_count + 1); |
| 2495 RecordJSReturnSite(expr); | 2537 RecordJSReturnSite(expr); |
| 2496 RestoreContext(); | 2538 RestoreContext(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2525 __ Move(eax, Immediate(arg_count)); | 2567 __ Move(eax, Immediate(arg_count)); |
| 2526 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | 2568 __ mov(edi, Operand(esp, arg_count * kPointerSize)); |
| 2527 | 2569 |
| 2528 // Record call targets in unoptimized code. | 2570 // Record call targets in unoptimized code. |
| 2529 __ EmitLoadTypeFeedbackVector(ebx); | 2571 __ EmitLoadTypeFeedbackVector(ebx); |
| 2530 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot()))); | 2572 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot()))); |
| 2531 | 2573 |
| 2532 CallConstructStub stub(isolate()); | 2574 CallConstructStub stub(isolate()); |
| 2533 __ call(stub.GetCode(), RelocInfo::CODE_TARGET); | 2575 __ call(stub.GetCode(), RelocInfo::CODE_TARGET); |
| 2534 OperandStackDepthDecrement(arg_count + 1); | 2576 OperandStackDepthDecrement(arg_count + 1); |
| 2535 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2577 PrepareForBailoutForId(expr->ReturnId(), |
| 2578 Deoptimizer::BailoutState::TOS_REGISTER); |
| 2536 RestoreContext(); | 2579 RestoreContext(); |
| 2537 context()->Plug(eax); | 2580 context()->Plug(eax); |
| 2538 } | 2581 } |
| 2539 | 2582 |
| 2540 | 2583 |
| 2541 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | 2584 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
| 2542 SuperCallReference* super_call_ref = | 2585 SuperCallReference* super_call_ref = |
| 2543 expr->expression()->AsSuperCallReference(); | 2586 expr->expression()->AsSuperCallReference(); |
| 2544 DCHECK_NOT_NULL(super_call_ref); | 2587 DCHECK_NOT_NULL(super_call_ref); |
| 2545 | 2588 |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2960 } | 3003 } |
| 2961 | 3004 |
| 2962 | 3005 |
| 2963 void FullCodeGenerator::EmitCall(CallRuntime* expr) { | 3006 void FullCodeGenerator::EmitCall(CallRuntime* expr) { |
| 2964 ZoneList<Expression*>* args = expr->arguments(); | 3007 ZoneList<Expression*>* args = expr->arguments(); |
| 2965 DCHECK_LE(2, args->length()); | 3008 DCHECK_LE(2, args->length()); |
| 2966 // Push target, receiver and arguments onto the stack. | 3009 // Push target, receiver and arguments onto the stack. |
| 2967 for (Expression* const arg : *args) { | 3010 for (Expression* const arg : *args) { |
| 2968 VisitForStackValue(arg); | 3011 VisitForStackValue(arg); |
| 2969 } | 3012 } |
| 2970 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | 3013 PrepareForBailoutForId(expr->CallId(), |
| 3014 Deoptimizer::BailoutState::NO_REGISTERS); |
| 2971 // Move target to edi. | 3015 // Move target to edi. |
| 2972 int const argc = args->length() - 2; | 3016 int const argc = args->length() - 2; |
| 2973 __ mov(edi, Operand(esp, (argc + 1) * kPointerSize)); | 3017 __ mov(edi, Operand(esp, (argc + 1) * kPointerSize)); |
| 2974 // Call the target. | 3018 // Call the target. |
| 2975 __ mov(eax, Immediate(argc)); | 3019 __ mov(eax, Immediate(argc)); |
| 2976 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 3020 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 2977 OperandStackDepthDecrement(argc + 1); | 3021 OperandStackDepthDecrement(argc + 1); |
| 2978 RestoreContext(); | 3022 RestoreContext(); |
| 2979 // Discard the function left on TOS. | 3023 // Discard the function left on TOS. |
| 2980 context()->DropAndPlug(1, eax); | 3024 context()->DropAndPlug(1, eax); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3174 // because we need to prepare a pair of extra administrative AST ids | 3218 // because we need to prepare a pair of extra administrative AST ids |
| 3175 // for the optimizing compiler. | 3219 // for the optimizing compiler. |
| 3176 DCHECK(context()->IsAccumulatorValue() || context()->IsStackValue()); | 3220 DCHECK(context()->IsAccumulatorValue() || context()->IsStackValue()); |
| 3177 Label materialize_true, materialize_false, done; | 3221 Label materialize_true, materialize_false, done; |
| 3178 VisitForControl(expr->expression(), | 3222 VisitForControl(expr->expression(), |
| 3179 &materialize_false, | 3223 &materialize_false, |
| 3180 &materialize_true, | 3224 &materialize_true, |
| 3181 &materialize_true); | 3225 &materialize_true); |
| 3182 if (!context()->IsAccumulatorValue()) OperandStackDepthIncrement(1); | 3226 if (!context()->IsAccumulatorValue()) OperandStackDepthIncrement(1); |
| 3183 __ bind(&materialize_true); | 3227 __ bind(&materialize_true); |
| 3184 PrepareForBailoutForId(expr->MaterializeTrueId(), NO_REGISTERS); | 3228 PrepareForBailoutForId(expr->MaterializeTrueId(), |
| 3229 Deoptimizer::BailoutState::NO_REGISTERS); |
| 3185 if (context()->IsAccumulatorValue()) { | 3230 if (context()->IsAccumulatorValue()) { |
| 3186 __ mov(eax, isolate()->factory()->true_value()); | 3231 __ mov(eax, isolate()->factory()->true_value()); |
| 3187 } else { | 3232 } else { |
| 3188 __ Push(isolate()->factory()->true_value()); | 3233 __ Push(isolate()->factory()->true_value()); |
| 3189 } | 3234 } |
| 3190 __ jmp(&done, Label::kNear); | 3235 __ jmp(&done, Label::kNear); |
| 3191 __ bind(&materialize_false); | 3236 __ bind(&materialize_false); |
| 3192 PrepareForBailoutForId(expr->MaterializeFalseId(), NO_REGISTERS); | 3237 PrepareForBailoutForId(expr->MaterializeFalseId(), |
| 3238 Deoptimizer::BailoutState::NO_REGISTERS); |
| 3193 if (context()->IsAccumulatorValue()) { | 3239 if (context()->IsAccumulatorValue()) { |
| 3194 __ mov(eax, isolate()->factory()->false_value()); | 3240 __ mov(eax, isolate()->factory()->false_value()); |
| 3195 } else { | 3241 } else { |
| 3196 __ Push(isolate()->factory()->false_value()); | 3242 __ Push(isolate()->factory()->false_value()); |
| 3197 } | 3243 } |
| 3198 __ bind(&done); | 3244 __ bind(&done); |
| 3199 } | 3245 } |
| 3200 break; | 3246 break; |
| 3201 } | 3247 } |
| 3202 | 3248 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3281 } | 3327 } |
| 3282 | 3328 |
| 3283 case VARIABLE: | 3329 case VARIABLE: |
| 3284 UNREACHABLE(); | 3330 UNREACHABLE(); |
| 3285 } | 3331 } |
| 3286 } | 3332 } |
| 3287 | 3333 |
| 3288 // We need a second deoptimization point after loading the value | 3334 // We need a second deoptimization point after loading the value |
| 3289 // in case evaluating the property load my have a side effect. | 3335 // in case evaluating the property load my have a side effect. |
| 3290 if (assign_type == VARIABLE) { | 3336 if (assign_type == VARIABLE) { |
| 3291 PrepareForBailout(expr->expression(), TOS_REG); | 3337 PrepareForBailout(expr->expression(), |
| 3338 Deoptimizer::BailoutState::TOS_REGISTER); |
| 3292 } else { | 3339 } else { |
| 3293 PrepareForBailoutForId(prop->LoadId(), TOS_REG); | 3340 PrepareForBailoutForId(prop->LoadId(), |
| 3341 Deoptimizer::BailoutState::TOS_REGISTER); |
| 3294 } | 3342 } |
| 3295 | 3343 |
| 3296 // Inline smi case if we are in a loop. | 3344 // Inline smi case if we are in a loop. |
| 3297 Label done, stub_call; | 3345 Label done, stub_call; |
| 3298 JumpPatchSite patch_site(masm_); | 3346 JumpPatchSite patch_site(masm_); |
| 3299 if (ShouldInlineSmiCase(expr->op())) { | 3347 if (ShouldInlineSmiCase(expr->op())) { |
| 3300 Label slow; | 3348 Label slow; |
| 3301 patch_site.EmitJumpIfNotSmi(eax, &slow, Label::kNear); | 3349 patch_site.EmitJumpIfNotSmi(eax, &slow, Label::kNear); |
| 3302 | 3350 |
| 3303 // Save result for postfix expressions. | 3351 // Save result for postfix expressions. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3338 } else { | 3386 } else { |
| 3339 __ add(eax, Immediate(Smi::FromInt(1))); | 3387 __ add(eax, Immediate(Smi::FromInt(1))); |
| 3340 } | 3388 } |
| 3341 __ jmp(&stub_call, Label::kNear); | 3389 __ jmp(&stub_call, Label::kNear); |
| 3342 __ bind(&slow); | 3390 __ bind(&slow); |
| 3343 } | 3391 } |
| 3344 | 3392 |
| 3345 // Convert old value into a number. | 3393 // Convert old value into a number. |
| 3346 ToNumberStub convert_stub(isolate()); | 3394 ToNumberStub convert_stub(isolate()); |
| 3347 __ CallStub(&convert_stub); | 3395 __ CallStub(&convert_stub); |
| 3348 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG); | 3396 PrepareForBailoutForId(expr->ToNumberId(), |
| 3397 Deoptimizer::BailoutState::TOS_REGISTER); |
| 3349 | 3398 |
| 3350 // Save result for postfix expressions. | 3399 // Save result for postfix expressions. |
| 3351 if (expr->is_postfix()) { | 3400 if (expr->is_postfix()) { |
| 3352 if (!context()->IsEffect()) { | 3401 if (!context()->IsEffect()) { |
| 3353 // Save the result on the stack. If we have a named or keyed property | 3402 // Save the result on the stack. If we have a named or keyed property |
| 3354 // we store the result under the receiver that is currently on top | 3403 // we store the result under the receiver that is currently on top |
| 3355 // of the stack. | 3404 // of the stack. |
| 3356 switch (assign_type) { | 3405 switch (assign_type) { |
| 3357 case VARIABLE: | 3406 case VARIABLE: |
| 3358 PushOperand(eax); | 3407 PushOperand(eax); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 3386 __ bind(&done); | 3435 __ bind(&done); |
| 3387 | 3436 |
| 3388 // Store the value returned in eax. | 3437 // Store the value returned in eax. |
| 3389 switch (assign_type) { | 3438 switch (assign_type) { |
| 3390 case VARIABLE: | 3439 case VARIABLE: |
| 3391 if (expr->is_postfix()) { | 3440 if (expr->is_postfix()) { |
| 3392 // Perform the assignment as if via '='. | 3441 // Perform the assignment as if via '='. |
| 3393 { EffectContext context(this); | 3442 { EffectContext context(this); |
| 3394 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 3443 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
| 3395 Token::ASSIGN, expr->CountSlot()); | 3444 Token::ASSIGN, expr->CountSlot()); |
| 3396 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 3445 PrepareForBailoutForId(expr->AssignmentId(), |
| 3446 Deoptimizer::BailoutState::TOS_REGISTER); |
| 3397 context.Plug(eax); | 3447 context.Plug(eax); |
| 3398 } | 3448 } |
| 3399 // For all contexts except EffectContext We have the result on | 3449 // For all contexts except EffectContext We have the result on |
| 3400 // top of the stack. | 3450 // top of the stack. |
| 3401 if (!context()->IsEffect()) { | 3451 if (!context()->IsEffect()) { |
| 3402 context()->PlugTOS(); | 3452 context()->PlugTOS(); |
| 3403 } | 3453 } |
| 3404 } else { | 3454 } else { |
| 3405 // Perform the assignment as if via '='. | 3455 // Perform the assignment as if via '='. |
| 3406 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 3456 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
| 3407 Token::ASSIGN, expr->CountSlot()); | 3457 Token::ASSIGN, expr->CountSlot()); |
| 3408 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 3458 PrepareForBailoutForId(expr->AssignmentId(), |
| 3459 Deoptimizer::BailoutState::TOS_REGISTER); |
| 3409 context()->Plug(eax); | 3460 context()->Plug(eax); |
| 3410 } | 3461 } |
| 3411 break; | 3462 break; |
| 3412 case NAMED_PROPERTY: { | 3463 case NAMED_PROPERTY: { |
| 3413 __ mov(StoreDescriptor::NameRegister(), | 3464 __ mov(StoreDescriptor::NameRegister(), |
| 3414 prop->key()->AsLiteral()->value()); | 3465 prop->key()->AsLiteral()->value()); |
| 3415 PopOperand(StoreDescriptor::ReceiverRegister()); | 3466 PopOperand(StoreDescriptor::ReceiverRegister()); |
| 3416 EmitLoadStoreICSlot(expr->CountSlot()); | 3467 EmitLoadStoreICSlot(expr->CountSlot()); |
| 3417 CallStoreIC(); | 3468 CallStoreIC(); |
| 3418 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 3469 PrepareForBailoutForId(expr->AssignmentId(), |
| 3470 Deoptimizer::BailoutState::TOS_REGISTER); |
| 3419 if (expr->is_postfix()) { | 3471 if (expr->is_postfix()) { |
| 3420 if (!context()->IsEffect()) { | 3472 if (!context()->IsEffect()) { |
| 3421 context()->PlugTOS(); | 3473 context()->PlugTOS(); |
| 3422 } | 3474 } |
| 3423 } else { | 3475 } else { |
| 3424 context()->Plug(eax); | 3476 context()->Plug(eax); |
| 3425 } | 3477 } |
| 3426 break; | 3478 break; |
| 3427 } | 3479 } |
| 3428 case NAMED_SUPER_PROPERTY: { | 3480 case NAMED_SUPER_PROPERTY: { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3447 } | 3499 } |
| 3448 break; | 3500 break; |
| 3449 } | 3501 } |
| 3450 case KEYED_PROPERTY: { | 3502 case KEYED_PROPERTY: { |
| 3451 PopOperand(StoreDescriptor::NameRegister()); | 3503 PopOperand(StoreDescriptor::NameRegister()); |
| 3452 PopOperand(StoreDescriptor::ReceiverRegister()); | 3504 PopOperand(StoreDescriptor::ReceiverRegister()); |
| 3453 Handle<Code> ic = | 3505 Handle<Code> ic = |
| 3454 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | 3506 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); |
| 3455 EmitLoadStoreICSlot(expr->CountSlot()); | 3507 EmitLoadStoreICSlot(expr->CountSlot()); |
| 3456 CallIC(ic); | 3508 CallIC(ic); |
| 3457 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 3509 PrepareForBailoutForId(expr->AssignmentId(), |
| 3510 Deoptimizer::BailoutState::TOS_REGISTER); |
| 3458 if (expr->is_postfix()) { | 3511 if (expr->is_postfix()) { |
| 3459 // Result is on the stack | 3512 // Result is on the stack |
| 3460 if (!context()->IsEffect()) { | 3513 if (!context()->IsEffect()) { |
| 3461 context()->PlugTOS(); | 3514 context()->PlugTOS(); |
| 3462 } | 3515 } |
| 3463 } else { | 3516 } else { |
| 3464 context()->Plug(eax); | 3517 context()->Plug(eax); |
| 3465 } | 3518 } |
| 3466 break; | 3519 break; |
| 3467 } | 3520 } |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3829 isolate->builtins()->OnStackReplacement()->entry(), | 3882 isolate->builtins()->OnStackReplacement()->entry(), |
| 3830 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3883 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 3831 return ON_STACK_REPLACEMENT; | 3884 return ON_STACK_REPLACEMENT; |
| 3832 } | 3885 } |
| 3833 | 3886 |
| 3834 | 3887 |
| 3835 } // namespace internal | 3888 } // namespace internal |
| 3836 } // namespace v8 | 3889 } // namespace v8 |
| 3837 | 3890 |
| 3838 #endif // V8_TARGET_ARCH_IA32 | 3891 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |