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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 2365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2376 | 2376 |
2377 CallConstructStub stub(isolate()); | 2377 CallConstructStub stub(isolate()); |
2378 CallIC(stub.GetCode()); | 2378 CallIC(stub.GetCode()); |
2379 OperandStackDepthDecrement(arg_count + 1); | 2379 OperandStackDepthDecrement(arg_count + 1); |
2380 PrepareForBailoutForId(expr->ReturnId(), BailoutState::TOS_REGISTER); | 2380 PrepareForBailoutForId(expr->ReturnId(), BailoutState::TOS_REGISTER); |
2381 RestoreContext(); | 2381 RestoreContext(); |
2382 context()->Plug(eax); | 2382 context()->Plug(eax); |
2383 } | 2383 } |
2384 | 2384 |
2385 | 2385 |
2386 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | |
2387 SuperCallReference* super_call_ref = | |
2388 expr->expression()->AsSuperCallReference(); | |
2389 DCHECK_NOT_NULL(super_call_ref); | |
2390 | |
2391 // Push the super constructor target on the stack (may be null, | |
2392 // but the Construct builtin can deal with that properly). | |
2393 VisitForAccumulatorValue(super_call_ref->this_function_var()); | |
2394 __ AssertFunction(result_register()); | |
2395 __ mov(result_register(), | |
2396 FieldOperand(result_register(), HeapObject::kMapOffset)); | |
2397 PushOperand(FieldOperand(result_register(), Map::kPrototypeOffset)); | |
2398 | |
2399 // Push the arguments ("left-to-right") on the stack. | |
2400 ZoneList<Expression*>* args = expr->arguments(); | |
2401 int arg_count = args->length(); | |
2402 for (int i = 0; i < arg_count; i++) { | |
2403 VisitForStackValue(args->at(i)); | |
2404 } | |
2405 | |
2406 // Call the construct call builtin that handles allocation and | |
2407 // constructor invocation. | |
2408 SetConstructCallPosition(expr); | |
2409 | |
2410 // Load new target into edx. | |
2411 VisitForAccumulatorValue(super_call_ref->new_target_var()); | |
2412 __ mov(edx, result_register()); | |
2413 | |
2414 // Load function and argument count into edi and eax. | |
2415 __ Move(eax, Immediate(arg_count)); | |
2416 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | |
2417 | |
2418 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | |
2419 OperandStackDepthDecrement(arg_count + 1); | |
2420 | |
2421 RecordJSReturnSite(expr); | |
2422 RestoreContext(); | |
2423 context()->Plug(eax); | |
2424 } | |
2425 | |
2426 | |
2427 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 2386 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
2428 ZoneList<Expression*>* args = expr->arguments(); | 2387 ZoneList<Expression*>* args = expr->arguments(); |
2429 DCHECK(args->length() == 1); | 2388 DCHECK(args->length() == 1); |
2430 | 2389 |
2431 VisitForAccumulatorValue(args->at(0)); | 2390 VisitForAccumulatorValue(args->at(0)); |
2432 | 2391 |
2433 Label materialize_true, materialize_false; | 2392 Label materialize_true, materialize_false; |
2434 Label* if_true = NULL; | 2393 Label* if_true = NULL; |
2435 Label* if_false = NULL; | 2394 Label* if_false = NULL; |
2436 Label* fall_through = NULL; | 2395 Label* fall_through = NULL; |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3469 isolate->builtins()->OnStackReplacement()->entry(), | 3428 isolate->builtins()->OnStackReplacement()->entry(), |
3470 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3429 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3471 return ON_STACK_REPLACEMENT; | 3430 return ON_STACK_REPLACEMENT; |
3472 } | 3431 } |
3473 | 3432 |
3474 | 3433 |
3475 } // namespace internal | 3434 } // namespace internal |
3476 } // namespace v8 | 3435 } // namespace v8 |
3477 | 3436 |
3478 #endif // V8_TARGET_ARCH_X87 | 3437 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |