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/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 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2384 | 2384 |
2385 CallConstructStub stub(isolate()); | 2385 CallConstructStub stub(isolate()); |
2386 CallIC(stub.GetCode()); | 2386 CallIC(stub.GetCode()); |
2387 OperandStackDepthDecrement(arg_count + 1); | 2387 OperandStackDepthDecrement(arg_count + 1); |
2388 PrepareForBailoutForId(expr->ReturnId(), BailoutState::TOS_REGISTER); | 2388 PrepareForBailoutForId(expr->ReturnId(), BailoutState::TOS_REGISTER); |
2389 RestoreContext(); | 2389 RestoreContext(); |
2390 context()->Plug(eax); | 2390 context()->Plug(eax); |
2391 } | 2391 } |
2392 | 2392 |
2393 | 2393 |
2394 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | |
2395 SuperCallReference* super_call_ref = | |
2396 expr->expression()->AsSuperCallReference(); | |
2397 DCHECK_NOT_NULL(super_call_ref); | |
2398 | |
2399 // Push the super constructor target on the stack (may be null, | |
2400 // but the Construct builtin can deal with that properly). | |
2401 VisitForAccumulatorValue(super_call_ref->this_function_var()); | |
2402 __ AssertFunction(result_register()); | |
2403 __ mov(result_register(), | |
2404 FieldOperand(result_register(), HeapObject::kMapOffset)); | |
2405 PushOperand(FieldOperand(result_register(), Map::kPrototypeOffset)); | |
2406 | |
2407 // Push the arguments ("left-to-right") on the stack. | |
2408 ZoneList<Expression*>* args = expr->arguments(); | |
2409 int arg_count = args->length(); | |
2410 for (int i = 0; i < arg_count; i++) { | |
2411 VisitForStackValue(args->at(i)); | |
2412 } | |
2413 | |
2414 // Call the construct call builtin that handles allocation and | |
2415 // constructor invocation. | |
2416 SetConstructCallPosition(expr); | |
2417 | |
2418 // Load new target into edx. | |
2419 VisitForAccumulatorValue(super_call_ref->new_target_var()); | |
2420 __ mov(edx, result_register()); | |
2421 | |
2422 // Load function and argument count into edi and eax. | |
2423 __ Move(eax, Immediate(arg_count)); | |
2424 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | |
2425 | |
2426 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | |
2427 OperandStackDepthDecrement(arg_count + 1); | |
2428 | |
2429 RecordJSReturnSite(expr); | |
2430 RestoreContext(); | |
2431 context()->Plug(eax); | |
2432 } | |
2433 | |
2434 | |
2435 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 2394 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
2436 ZoneList<Expression*>* args = expr->arguments(); | 2395 ZoneList<Expression*>* args = expr->arguments(); |
2437 DCHECK(args->length() == 1); | 2396 DCHECK(args->length() == 1); |
2438 | 2397 |
2439 VisitForAccumulatorValue(args->at(0)); | 2398 VisitForAccumulatorValue(args->at(0)); |
2440 | 2399 |
2441 Label materialize_true, materialize_false; | 2400 Label materialize_true, materialize_false; |
2442 Label* if_true = NULL; | 2401 Label* if_true = NULL; |
2443 Label* if_false = NULL; | 2402 Label* if_false = NULL; |
2444 Label* fall_through = NULL; | 2403 Label* fall_through = NULL; |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3477 isolate->builtins()->OnStackReplacement()->entry(), | 3436 isolate->builtins()->OnStackReplacement()->entry(), |
3478 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3437 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3479 return ON_STACK_REPLACEMENT; | 3438 return ON_STACK_REPLACEMENT; |
3480 } | 3439 } |
3481 | 3440 |
3482 | 3441 |
3483 } // namespace internal | 3442 } // namespace internal |
3484 } // namespace v8 | 3443 } // namespace v8 |
3485 | 3444 |
3486 #endif // V8_TARGET_ARCH_IA32 | 3445 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |