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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 __ movp(rcx, FieldOperand(rdi, JSFunction::kLiteralsOffset)); | 124 __ movp(rcx, FieldOperand(rdi, JSFunction::kFeedbackVectorOffset)); |
125 __ movp(rcx, FieldOperand(rcx, LiteralsArray::kFeedbackVectorOffset)); | |
126 __ SmiAddConstant( | 125 __ SmiAddConstant( |
127 FieldOperand(rcx, | 126 FieldOperand(rcx, |
128 TypeFeedbackVector::kInvocationCountIndex * kPointerSize + | 127 TypeFeedbackVector::kInvocationCountIndex * kPointerSize + |
129 TypeFeedbackVector::kHeaderSize), | 128 TypeFeedbackVector::kHeaderSize), |
130 Smi::FromInt(1)); | 129 Smi::FromInt(1)); |
131 } | 130 } |
132 | 131 |
133 { Comment cmnt(masm_, "[ Allocate locals"); | 132 { Comment cmnt(masm_, "[ Allocate locals"); |
134 int locals_count = info->scope()->num_stack_slots(); | 133 int locals_count = info->scope()->num_stack_slots(); |
135 OperandStackDepthIncrement(locals_count); | 134 OperandStackDepthIncrement(locals_count); |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 | 1167 |
1169 | 1168 |
1170 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1169 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
1171 Comment cmnt(masm_, "[ ObjectLiteral"); | 1170 Comment cmnt(masm_, "[ ObjectLiteral"); |
1172 | 1171 |
1173 Handle<FixedArray> constant_properties = | 1172 Handle<FixedArray> constant_properties = |
1174 expr->GetOrBuildConstantProperties(isolate()); | 1173 expr->GetOrBuildConstantProperties(isolate()); |
1175 int flags = expr->ComputeFlags(); | 1174 int flags = expr->ComputeFlags(); |
1176 if (MustCreateObjectLiteralWithRuntime(expr)) { | 1175 if (MustCreateObjectLiteralWithRuntime(expr)) { |
1177 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1176 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1178 __ Push(Smi::FromInt(expr->literal_index())); | 1177 __ Push(SmiFromSlot(expr->literal_slot())); |
1179 __ Push(constant_properties); | 1178 __ Push(constant_properties); |
1180 __ Push(Smi::FromInt(flags)); | 1179 __ Push(Smi::FromInt(flags)); |
1181 __ CallRuntime(Runtime::kCreateObjectLiteral); | 1180 __ CallRuntime(Runtime::kCreateObjectLiteral); |
1182 } else { | 1181 } else { |
1183 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1182 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1184 __ Move(rbx, Smi::FromInt(expr->literal_index())); | 1183 __ Move(rbx, SmiFromSlot(expr->literal_slot())); |
1185 __ Move(rcx, constant_properties); | 1184 __ Move(rcx, constant_properties); |
1186 __ Move(rdx, Smi::FromInt(flags)); | 1185 __ Move(rdx, Smi::FromInt(flags)); |
1187 Callable callable = CodeFactory::FastCloneShallowObject( | 1186 Callable callable = CodeFactory::FastCloneShallowObject( |
1188 isolate(), expr->properties_count()); | 1187 isolate(), expr->properties_count()); |
1189 __ Call(callable.code(), RelocInfo::CODE_TARGET); | 1188 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
1190 RestoreContext(); | 1189 RestoreContext(); |
1191 } | 1190 } |
1192 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); | 1191 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); |
1193 | 1192 |
1194 // If result_saved is true the result is on top of the stack. If | 1193 // If result_saved is true the result is on top of the stack. If |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 | 1303 |
1305 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; | 1304 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; |
1306 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { | 1305 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { |
1307 // If the only customer of allocation sites is transitioning, then | 1306 // If the only customer of allocation sites is transitioning, then |
1308 // we can turn it off if we don't have anywhere else to transition to. | 1307 // we can turn it off if we don't have anywhere else to transition to. |
1309 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | 1308 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
1310 } | 1309 } |
1311 | 1310 |
1312 if (MustCreateArrayLiteralWithRuntime(expr)) { | 1311 if (MustCreateArrayLiteralWithRuntime(expr)) { |
1313 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1312 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1314 __ Push(Smi::FromInt(expr->literal_index())); | 1313 __ Push(SmiFromSlot(expr->literal_slot())); |
1315 __ Push(constant_elements); | 1314 __ Push(constant_elements); |
1316 __ Push(Smi::FromInt(expr->ComputeFlags())); | 1315 __ Push(Smi::FromInt(expr->ComputeFlags())); |
1317 __ CallRuntime(Runtime::kCreateArrayLiteral); | 1316 __ CallRuntime(Runtime::kCreateArrayLiteral); |
1318 } else { | 1317 } else { |
1319 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1318 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1320 __ Move(rbx, Smi::FromInt(expr->literal_index())); | 1319 __ Move(rbx, SmiFromSlot(expr->literal_slot())); |
1321 __ Move(rcx, constant_elements); | 1320 __ Move(rcx, constant_elements); |
1322 Callable callable = | 1321 Callable callable = |
1323 CodeFactory::FastCloneShallowArray(isolate(), allocation_site_mode); | 1322 CodeFactory::FastCloneShallowArray(isolate(), allocation_site_mode); |
1324 __ Call(callable.code(), RelocInfo::CODE_TARGET); | 1323 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
1325 RestoreContext(); | 1324 RestoreContext(); |
1326 } | 1325 } |
1327 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); | 1326 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); |
1328 | 1327 |
1329 bool result_saved = false; // Is the result saved to the stack? | 1328 bool result_saved = false; // Is the result saved to the stack? |
1330 ZoneList<Expression*>* subexprs = expr->values(); | 1329 ZoneList<Expression*>* subexprs = expr->values(); |
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2762 DCHECK_EQ( | 2761 DCHECK_EQ( |
2763 isolate->builtins()->OnStackReplacement()->entry(), | 2762 isolate->builtins()->OnStackReplacement()->entry(), |
2764 Assembler::target_address_at(call_target_address, unoptimized_code)); | 2763 Assembler::target_address_at(call_target_address, unoptimized_code)); |
2765 return ON_STACK_REPLACEMENT; | 2764 return ON_STACK_REPLACEMENT; |
2766 } | 2765 } |
2767 | 2766 |
2768 } // namespace internal | 2767 } // namespace internal |
2769 } // namespace v8 | 2768 } // namespace v8 |
2770 | 2769 |
2771 #endif // V8_TARGET_ARCH_X64 | 2770 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |