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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1171 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1172 __ Push(Smi::FromInt(expr->literal_index())); | 1172 __ Push(Smi::FromInt(expr->literal_index())); |
1173 __ Push(constant_properties); | 1173 __ Push(constant_properties); |
1174 __ Push(Smi::FromInt(flags)); | 1174 __ Push(Smi::FromInt(flags)); |
1175 __ CallRuntime(Runtime::kCreateObjectLiteral); | 1175 __ CallRuntime(Runtime::kCreateObjectLiteral); |
1176 } else { | 1176 } else { |
1177 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1177 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1178 __ Move(rbx, Smi::FromInt(expr->literal_index())); | 1178 __ Move(rbx, Smi::FromInt(expr->literal_index())); |
1179 __ Move(rcx, constant_properties); | 1179 __ Move(rcx, constant_properties); |
1180 __ Move(rdx, Smi::FromInt(flags)); | 1180 __ Move(rdx, Smi::FromInt(flags)); |
1181 FastCloneShallowObjectStub stub(isolate(), expr->properties_count()); | 1181 Callable callable = CodeFactory::FastCloneShallowObject( |
1182 __ CallStub(&stub); | 1182 isolate(), expr->properties_count()); |
| 1183 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
1183 RestoreContext(); | 1184 RestoreContext(); |
1184 } | 1185 } |
1185 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); | 1186 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); |
1186 | 1187 |
1187 // If result_saved is true the result is on top of the stack. If | 1188 // If result_saved is true the result is on top of the stack. If |
1188 // result_saved is false the result is in rax. | 1189 // result_saved is false the result is in rax. |
1189 bool result_saved = false; | 1190 bool result_saved = false; |
1190 | 1191 |
1191 AccessorTable accessor_table(zone()); | 1192 AccessorTable accessor_table(zone()); |
1192 for (int i = 0; i < expr->properties()->length(); i++) { | 1193 for (int i = 0; i < expr->properties()->length(); i++) { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 if (MustCreateArrayLiteralWithRuntime(expr)) { | 1304 if (MustCreateArrayLiteralWithRuntime(expr)) { |
1304 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1305 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1305 __ Push(Smi::FromInt(expr->literal_index())); | 1306 __ Push(Smi::FromInt(expr->literal_index())); |
1306 __ Push(constant_elements); | 1307 __ Push(constant_elements); |
1307 __ Push(Smi::FromInt(expr->ComputeFlags())); | 1308 __ Push(Smi::FromInt(expr->ComputeFlags())); |
1308 __ CallRuntime(Runtime::kCreateArrayLiteral); | 1309 __ CallRuntime(Runtime::kCreateArrayLiteral); |
1309 } else { | 1310 } else { |
1310 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1311 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1311 __ Move(rbx, Smi::FromInt(expr->literal_index())); | 1312 __ Move(rbx, Smi::FromInt(expr->literal_index())); |
1312 __ Move(rcx, constant_elements); | 1313 __ Move(rcx, constant_elements); |
1313 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); | 1314 Callable callable = |
1314 __ CallStub(&stub); | 1315 CodeFactory::FastCloneShallowArray(isolate(), allocation_site_mode); |
| 1316 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
1315 RestoreContext(); | 1317 RestoreContext(); |
1316 } | 1318 } |
1317 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); | 1319 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); |
1318 | 1320 |
1319 bool result_saved = false; // Is the result saved to the stack? | 1321 bool result_saved = false; // Is the result saved to the stack? |
1320 ZoneList<Expression*>* subexprs = expr->values(); | 1322 ZoneList<Expression*>* subexprs = expr->values(); |
1321 int length = subexprs->length(); | 1323 int length = subexprs->length(); |
1322 | 1324 |
1323 // Emit code to evaluate all the non-constant subexpressions and to store | 1325 // Emit code to evaluate all the non-constant subexpressions and to store |
1324 // them into the newly cloned array. | 1326 // them into the newly cloned array. |
(...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2774 DCHECK_EQ( | 2776 DCHECK_EQ( |
2775 isolate->builtins()->OnStackReplacement()->entry(), | 2777 isolate->builtins()->OnStackReplacement()->entry(), |
2776 Assembler::target_address_at(call_target_address, unoptimized_code)); | 2778 Assembler::target_address_at(call_target_address, unoptimized_code)); |
2777 return ON_STACK_REPLACEMENT; | 2779 return ON_STACK_REPLACEMENT; |
2778 } | 2780 } |
2779 | 2781 |
2780 } // namespace internal | 2782 } // namespace internal |
2781 } // namespace v8 | 2783 } // namespace v8 |
2782 | 2784 |
2783 #endif // V8_TARGET_ARCH_X64 | 2785 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |