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/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/ast/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2372 __ Move(rdx, SmiFromSlot(expr->CallNewFeedbackSlot())); | 2372 __ Move(rdx, SmiFromSlot(expr->CallNewFeedbackSlot())); |
2373 | 2373 |
2374 CallConstructStub stub(isolate()); | 2374 CallConstructStub stub(isolate()); |
2375 CallIC(stub.GetCode()); | 2375 CallIC(stub.GetCode()); |
2376 OperandStackDepthDecrement(arg_count + 1); | 2376 OperandStackDepthDecrement(arg_count + 1); |
2377 PrepareForBailoutForId(expr->ReturnId(), BailoutState::TOS_REGISTER); | 2377 PrepareForBailoutForId(expr->ReturnId(), BailoutState::TOS_REGISTER); |
2378 RestoreContext(); | 2378 RestoreContext(); |
2379 context()->Plug(rax); | 2379 context()->Plug(rax); |
2380 } | 2380 } |
2381 | 2381 |
2382 | |
2383 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | |
2384 SuperCallReference* super_call_ref = | |
2385 expr->expression()->AsSuperCallReference(); | |
2386 DCHECK_NOT_NULL(super_call_ref); | |
2387 | |
2388 // Push the super constructor target on the stack (may be null, | |
2389 // but the Construct builtin can deal with that properly). | |
2390 VisitForAccumulatorValue(super_call_ref->this_function_var()); | |
2391 __ AssertFunction(result_register()); | |
2392 __ movp(result_register(), | |
2393 FieldOperand(result_register(), HeapObject::kMapOffset)); | |
2394 PushOperand(FieldOperand(result_register(), Map::kPrototypeOffset)); | |
2395 | |
2396 // Push the arguments ("left-to-right") on the stack. | |
2397 ZoneList<Expression*>* args = expr->arguments(); | |
2398 int arg_count = args->length(); | |
2399 for (int i = 0; i < arg_count; i++) { | |
2400 VisitForStackValue(args->at(i)); | |
2401 } | |
2402 | |
2403 // Call the construct call builtin that handles allocation and | |
2404 // constructor invocation. | |
2405 SetConstructCallPosition(expr); | |
2406 | |
2407 // Load new target into rdx. | |
2408 VisitForAccumulatorValue(super_call_ref->new_target_var()); | |
2409 __ movp(rdx, result_register()); | |
2410 | |
2411 // Load function and argument count into rdi and rax. | |
2412 __ Set(rax, arg_count); | |
2413 __ movp(rdi, Operand(rsp, arg_count * kPointerSize)); | |
2414 | |
2415 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | |
2416 OperandStackDepthDecrement(arg_count + 1); | |
2417 | |
2418 RecordJSReturnSite(expr); | |
2419 RestoreContext(); | |
2420 context()->Plug(rax); | |
2421 } | |
2422 | |
2423 | |
2424 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 2382 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
2425 ZoneList<Expression*>* args = expr->arguments(); | 2383 ZoneList<Expression*>* args = expr->arguments(); |
2426 DCHECK(args->length() == 1); | 2384 DCHECK(args->length() == 1); |
2427 | 2385 |
2428 VisitForAccumulatorValue(args->at(0)); | 2386 VisitForAccumulatorValue(args->at(0)); |
2429 | 2387 |
2430 Label materialize_true, materialize_false; | 2388 Label materialize_true, materialize_false; |
2431 Label* if_true = NULL; | 2389 Label* if_true = NULL; |
2432 Label* if_false = NULL; | 2390 Label* if_false = NULL; |
2433 Label* fall_through = NULL; | 2391 Label* fall_through = NULL; |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3464 DCHECK_EQ( | 3422 DCHECK_EQ( |
3465 isolate->builtins()->OnStackReplacement()->entry(), | 3423 isolate->builtins()->OnStackReplacement()->entry(), |
3466 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3424 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3467 return ON_STACK_REPLACEMENT; | 3425 return ON_STACK_REPLACEMENT; |
3468 } | 3426 } |
3469 | 3427 |
3470 } // namespace internal | 3428 } // namespace internal |
3471 } // namespace v8 | 3429 } // namespace v8 |
3472 | 3430 |
3473 #endif // V8_TARGET_ARCH_X64 | 3431 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |