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/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/builtins/builtins-constructor.h" | 9 #include "src/builtins/builtins-constructor.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // MANUAL indicates that the scope shouldn't actually generate code to set up | 114 // MANUAL indicates that the scope shouldn't actually generate code to set up |
115 // the frame (that is done below). | 115 // the frame (that is done below). |
116 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 116 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
117 | 117 |
118 info->set_prologue_offset(masm_->pc_offset()); | 118 info->set_prologue_offset(masm_->pc_offset()); |
119 __ Prologue(info->GeneratePreagedPrologue()); | 119 __ Prologue(info->GeneratePreagedPrologue()); |
120 | 120 |
121 // Increment invocation count for the function. | 121 // Increment invocation count for the function. |
122 { | 122 { |
123 Comment cmnt(masm_, "[ Increment invocation count"); | 123 Comment cmnt(masm_, "[ Increment invocation count"); |
124 __ mov(ecx, FieldOperand(edi, JSFunction::kLiteralsOffset)); | 124 __ mov(ecx, FieldOperand(edi, JSFunction::kFeedbackVectorOffset)); |
125 __ mov(ecx, FieldOperand(ecx, LiteralsArray::kFeedbackVectorOffset)); | |
126 __ add(FieldOperand( | 125 __ add(FieldOperand( |
127 ecx, TypeFeedbackVector::kInvocationCountIndex * kPointerSize + | 126 ecx, TypeFeedbackVector::kInvocationCountIndex * kPointerSize + |
128 TypeFeedbackVector::kHeaderSize), | 127 TypeFeedbackVector::kHeaderSize), |
129 Immediate(Smi::FromInt(1))); | 128 Immediate(Smi::FromInt(1))); |
130 } | 129 } |
131 | 130 |
132 { Comment cmnt(masm_, "[ Allocate locals"); | 131 { Comment cmnt(masm_, "[ Allocate locals"); |
133 int locals_count = info->scope()->num_stack_slots(); | 132 int locals_count = info->scope()->num_stack_slots(); |
134 OperandStackDepthIncrement(locals_count); | 133 OperandStackDepthIncrement(locals_count); |
135 if (locals_count == 1) { | 134 if (locals_count == 1) { |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1138 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
1140 Comment cmnt(masm_, "[ ObjectLiteral"); | 1139 Comment cmnt(masm_, "[ ObjectLiteral"); |
1141 | 1140 |
1142 Handle<FixedArray> constant_properties = | 1141 Handle<FixedArray> constant_properties = |
1143 expr->GetOrBuildConstantProperties(isolate()); | 1142 expr->GetOrBuildConstantProperties(isolate()); |
1144 int flags = expr->ComputeFlags(); | 1143 int flags = expr->ComputeFlags(); |
1145 // If any of the keys would store to the elements array, then we shouldn't | 1144 // If any of the keys would store to the elements array, then we shouldn't |
1146 // allow it. | 1145 // allow it. |
1147 if (MustCreateObjectLiteralWithRuntime(expr)) { | 1146 if (MustCreateObjectLiteralWithRuntime(expr)) { |
1148 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1147 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
1149 __ push(Immediate(Smi::FromInt(expr->literal_index()))); | 1148 __ push(Immediate(SmiFromSlot(expr->literal_slot()))); |
1150 __ push(Immediate(constant_properties)); | 1149 __ push(Immediate(constant_properties)); |
1151 __ push(Immediate(Smi::FromInt(flags))); | 1150 __ push(Immediate(Smi::FromInt(flags))); |
1152 __ CallRuntime(Runtime::kCreateObjectLiteral); | 1151 __ CallRuntime(Runtime::kCreateObjectLiteral); |
1153 } else { | 1152 } else { |
1154 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1153 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
1155 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); | 1154 __ mov(ebx, Immediate(SmiFromSlot(expr->literal_slot()))); |
1156 __ mov(ecx, Immediate(constant_properties)); | 1155 __ mov(ecx, Immediate(constant_properties)); |
1157 __ mov(edx, Immediate(Smi::FromInt(flags))); | 1156 __ mov(edx, Immediate(Smi::FromInt(flags))); |
1158 Callable callable = CodeFactory::FastCloneShallowObject( | 1157 Callable callable = CodeFactory::FastCloneShallowObject( |
1159 isolate(), expr->properties_count()); | 1158 isolate(), expr->properties_count()); |
1160 __ Call(callable.code(), RelocInfo::CODE_TARGET); | 1159 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
1161 RestoreContext(); | 1160 RestoreContext(); |
1162 } | 1161 } |
1163 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); | 1162 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); |
1164 | 1163 |
1165 // If result_saved is true the result is on top of the stack. If | 1164 // If result_saved is true the result is on top of the stack. If |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 | 1275 |
1277 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; | 1276 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; |
1278 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { | 1277 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { |
1279 // If the only customer of allocation sites is transitioning, then | 1278 // If the only customer of allocation sites is transitioning, then |
1280 // we can turn it off if we don't have anywhere else to transition to. | 1279 // we can turn it off if we don't have anywhere else to transition to. |
1281 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | 1280 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
1282 } | 1281 } |
1283 | 1282 |
1284 if (MustCreateArrayLiteralWithRuntime(expr)) { | 1283 if (MustCreateArrayLiteralWithRuntime(expr)) { |
1285 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1284 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
1286 __ push(Immediate(Smi::FromInt(expr->literal_index()))); | 1285 __ push(Immediate(SmiFromSlot(expr->literal_slot()))); |
1287 __ push(Immediate(constant_elements)); | 1286 __ push(Immediate(constant_elements)); |
1288 __ push(Immediate(Smi::FromInt(expr->ComputeFlags()))); | 1287 __ push(Immediate(Smi::FromInt(expr->ComputeFlags()))); |
1289 __ CallRuntime(Runtime::kCreateArrayLiteral); | 1288 __ CallRuntime(Runtime::kCreateArrayLiteral); |
1290 } else { | 1289 } else { |
1291 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1290 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
1292 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); | 1291 __ mov(ebx, Immediate(SmiFromSlot(expr->literal_slot()))); |
1293 __ mov(ecx, Immediate(constant_elements)); | 1292 __ mov(ecx, Immediate(constant_elements)); |
1294 Callable callable = | 1293 Callable callable = |
1295 CodeFactory::FastCloneShallowArray(isolate(), allocation_site_mode); | 1294 CodeFactory::FastCloneShallowArray(isolate(), allocation_site_mode); |
1296 __ Call(callable.code(), RelocInfo::CODE_TARGET); | 1295 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
1297 RestoreContext(); | 1296 RestoreContext(); |
1298 } | 1297 } |
1299 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); | 1298 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); |
1300 | 1299 |
1301 bool result_saved = false; // Is the result saved to the stack? | 1300 bool result_saved = false; // Is the result saved to the stack? |
1302 ZoneList<Expression*>* subexprs = expr->values(); | 1301 ZoneList<Expression*>* subexprs = expr->values(); |
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2780 isolate->builtins()->OnStackReplacement()->entry(), | 2779 isolate->builtins()->OnStackReplacement()->entry(), |
2781 Assembler::target_address_at(call_target_address, unoptimized_code)); | 2780 Assembler::target_address_at(call_target_address, unoptimized_code)); |
2782 return ON_STACK_REPLACEMENT; | 2781 return ON_STACK_REPLACEMENT; |
2783 } | 2782 } |
2784 | 2783 |
2785 | 2784 |
2786 } // namespace internal | 2785 } // namespace internal |
2787 } // namespace v8 | 2786 } // namespace v8 |
2788 | 2787 |
2789 #endif // V8_TARGET_ARCH_IA32 | 2788 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |