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/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 | 2021 |
2022 | 2022 |
2023 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2023 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2024 SetExpressionPosition(prop); | 2024 SetExpressionPosition(prop); |
2025 Literal* key = prop->key()->AsLiteral(); | 2025 Literal* key = prop->key()->AsLiteral(); |
2026 DCHECK(!prop->IsSuperAccess()); | 2026 DCHECK(!prop->IsSuperAccess()); |
2027 | 2027 |
2028 __ Move(LoadDescriptor::NameRegister(), key->value()); | 2028 __ Move(LoadDescriptor::NameRegister(), key->value()); |
2029 __ Move(LoadDescriptor::SlotRegister(), | 2029 __ Move(LoadDescriptor::SlotRegister(), |
2030 SmiFromSlot(prop->PropertyFeedbackSlot())); | 2030 SmiFromSlot(prop->PropertyFeedbackSlot())); |
2031 CallLoadIC(NOT_INSIDE_TYPEOF, language_mode()); | 2031 CallLoadIC(NOT_INSIDE_TYPEOF); |
2032 } | 2032 } |
2033 | 2033 |
2034 | 2034 |
2035 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2035 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
2036 // Stack: receiver, home_object | 2036 // Stack: receiver, home_object |
2037 SetExpressionPosition(prop); | 2037 SetExpressionPosition(prop); |
2038 Literal* key = prop->key()->AsLiteral(); | 2038 Literal* key = prop->key()->AsLiteral(); |
2039 DCHECK(!key->value()->IsSmi()); | 2039 DCHECK(!key->value()->IsSmi()); |
2040 DCHECK(prop->IsSuperAccess()); | 2040 DCHECK(prop->IsSuperAccess()); |
2041 | 2041 |
2042 __ Push(key->value()); | 2042 __ Push(key->value()); |
2043 __ Push(Smi::FromInt(language_mode())); | |
2044 __ CallRuntime(Runtime::kLoadFromSuper); | 2043 __ CallRuntime(Runtime::kLoadFromSuper); |
2045 } | 2044 } |
2046 | 2045 |
2047 | 2046 |
2048 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2047 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
2049 SetExpressionPosition(prop); | 2048 SetExpressionPosition(prop); |
2050 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code(); | 2049 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
2051 __ Move(LoadDescriptor::SlotRegister(), | 2050 __ Move(LoadDescriptor::SlotRegister(), |
2052 SmiFromSlot(prop->PropertyFeedbackSlot())); | 2051 SmiFromSlot(prop->PropertyFeedbackSlot())); |
2053 CallIC(ic); | 2052 CallIC(ic); |
2054 } | 2053 } |
2055 | 2054 |
2056 | 2055 |
2057 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2056 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
2058 // Stack: receiver, home_object, key. | 2057 // Stack: receiver, home_object, key. |
2059 SetExpressionPosition(prop); | 2058 SetExpressionPosition(prop); |
2060 __ Push(Smi::FromInt(language_mode())); | |
2061 __ CallRuntime(Runtime::kLoadKeyedFromSuper); | 2059 __ CallRuntime(Runtime::kLoadKeyedFromSuper); |
2062 } | 2060 } |
2063 | 2061 |
2064 | 2062 |
2065 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2063 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
2066 Token::Value op, | 2064 Token::Value op, |
2067 Expression* left, | 2065 Expression* left, |
2068 Expression* right) { | 2066 Expression* right) { |
2069 // Do combined smi check of the operands. Left operand is on the | 2067 // Do combined smi check of the operands. Left operand is on the |
2070 // stack (popped into rdx). Right operand is in rax but moved into | 2068 // stack (popped into rdx). Right operand is in rax but moved into |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2525 Literal* key = prop->key()->AsLiteral(); | 2523 Literal* key = prop->key()->AsLiteral(); |
2526 DCHECK(!key->value()->IsSmi()); | 2524 DCHECK(!key->value()->IsSmi()); |
2527 // Load the function from the receiver. | 2525 // Load the function from the receiver. |
2528 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2526 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
2529 VisitForStackValue(super_ref->home_object()); | 2527 VisitForStackValue(super_ref->home_object()); |
2530 VisitForAccumulatorValue(super_ref->this_var()); | 2528 VisitForAccumulatorValue(super_ref->this_var()); |
2531 __ Push(rax); | 2529 __ Push(rax); |
2532 __ Push(rax); | 2530 __ Push(rax); |
2533 __ Push(Operand(rsp, kPointerSize * 2)); | 2531 __ Push(Operand(rsp, kPointerSize * 2)); |
2534 __ Push(key->value()); | 2532 __ Push(key->value()); |
2535 __ Push(Smi::FromInt(language_mode())); | |
2536 | 2533 |
2537 // Stack here: | 2534 // Stack here: |
2538 // - home_object | 2535 // - home_object |
2539 // - this (receiver) | 2536 // - this (receiver) |
2540 // - this (receiver) <-- LoadFromSuper will pop here and below. | 2537 // - this (receiver) <-- LoadFromSuper will pop here and below. |
2541 // - home_object | 2538 // - home_object |
2542 // - key | 2539 // - key |
2543 // - language_mode | |
2544 __ CallRuntime(Runtime::kLoadFromSuper); | 2540 __ CallRuntime(Runtime::kLoadFromSuper); |
2545 | 2541 |
2546 // Replace home_object with target function. | 2542 // Replace home_object with target function. |
2547 __ movp(Operand(rsp, kPointerSize), rax); | 2543 __ movp(Operand(rsp, kPointerSize), rax); |
2548 | 2544 |
2549 // Stack here: | 2545 // Stack here: |
2550 // - target function | 2546 // - target function |
2551 // - this (receiver) | 2547 // - this (receiver) |
2552 EmitCall(expr); | 2548 EmitCall(expr); |
2553 } | 2549 } |
(...skipping 30 matching lines...) Expand all Loading... |
2584 | 2580 |
2585 SetExpressionPosition(prop); | 2581 SetExpressionPosition(prop); |
2586 // Load the function from the receiver. | 2582 // Load the function from the receiver. |
2587 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2583 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
2588 VisitForStackValue(super_ref->home_object()); | 2584 VisitForStackValue(super_ref->home_object()); |
2589 VisitForAccumulatorValue(super_ref->this_var()); | 2585 VisitForAccumulatorValue(super_ref->this_var()); |
2590 __ Push(rax); | 2586 __ Push(rax); |
2591 __ Push(rax); | 2587 __ Push(rax); |
2592 __ Push(Operand(rsp, kPointerSize * 2)); | 2588 __ Push(Operand(rsp, kPointerSize * 2)); |
2593 VisitForStackValue(prop->key()); | 2589 VisitForStackValue(prop->key()); |
2594 __ Push(Smi::FromInt(language_mode())); | |
2595 | 2590 |
2596 // Stack here: | 2591 // Stack here: |
2597 // - home_object | 2592 // - home_object |
2598 // - this (receiver) | 2593 // - this (receiver) |
2599 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | 2594 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
2600 // - home_object | 2595 // - home_object |
2601 // - key | 2596 // - key |
2602 // - language_mode | |
2603 __ CallRuntime(Runtime::kLoadKeyedFromSuper); | 2597 __ CallRuntime(Runtime::kLoadKeyedFromSuper); |
2604 | 2598 |
2605 // Replace home_object with target function. | 2599 // Replace home_object with target function. |
2606 __ movp(Operand(rsp, kPointerSize), rax); | 2600 __ movp(Operand(rsp, kPointerSize), rax); |
2607 | 2601 |
2608 // Stack here: | 2602 // Stack here: |
2609 // - target function | 2603 // - target function |
2610 // - this (receiver) | 2604 // - this (receiver) |
2611 EmitCall(expr); | 2605 EmitCall(expr); |
2612 } | 2606 } |
(...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4504 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4498 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4505 Assembler::target_address_at(call_target_address, | 4499 Assembler::target_address_at(call_target_address, |
4506 unoptimized_code)); | 4500 unoptimized_code)); |
4507 return OSR_AFTER_STACK_CHECK; | 4501 return OSR_AFTER_STACK_CHECK; |
4508 } | 4502 } |
4509 | 4503 |
4510 } // namespace internal | 4504 } // namespace internal |
4511 } // namespace v8 | 4505 } // namespace v8 |
4512 | 4506 |
4513 #endif // V8_TARGET_ARCH_X64 | 4507 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |