| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } else if (FLAG_debug_code) { | 224 } else if (FLAG_debug_code) { |
| 225 Label done; | 225 Label done; |
| 226 __ JumpIfInNewSpace(esi, eax, &done, Label::kNear); | 226 __ JumpIfInNewSpace(esi, eax, &done, Label::kNear); |
| 227 __ Abort(kExpectedNewSpaceObject); | 227 __ Abort(kExpectedNewSpaceObject); |
| 228 __ bind(&done); | 228 __ bind(&done); |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 } | 231 } |
| 232 } | 232 } |
| 233 | 233 |
| 234 Variable* home_object_var = scope()->home_object_var(); | |
| 235 if (home_object_var != nullptr) { | |
| 236 __ push(edi); | |
| 237 } | |
| 238 | |
| 239 // Possibly set up a local binding to the this function which is used in | 234 // Possibly set up a local binding to the this function which is used in |
| 240 // derived constructors with super calls. | 235 // derived constructors with super calls. |
| 241 Variable* this_function_var = scope()->this_function_var(); | 236 Variable* this_function_var = scope()->this_function_var(); |
| 242 if (this_function_var != nullptr) { | 237 if (this_function_var != nullptr) { |
| 243 Comment cmnt(masm_, "[ This function"); | 238 Comment cmnt(masm_, "[ This function"); |
| 244 SetVar(this_function_var, edi, ebx, edx); | 239 SetVar(this_function_var, edi, ebx, edx); |
| 245 } | 240 } |
| 246 | 241 |
| 247 Variable* new_target_var = scope()->new_target_var(); | 242 Variable* new_target_var = scope()->new_target_var(); |
| 248 if (new_target_var != nullptr) { | 243 if (new_target_var != nullptr) { |
| (...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 | 1903 |
| 1909 // Evaluate LHS expression. | 1904 // Evaluate LHS expression. |
| 1910 switch (assign_type) { | 1905 switch (assign_type) { |
| 1911 case VARIABLE: | 1906 case VARIABLE: |
| 1912 // Nothing to do here. | 1907 // Nothing to do here. |
| 1913 break; | 1908 break; |
| 1914 case NAMED_SUPER_PROPERTY: | 1909 case NAMED_SUPER_PROPERTY: |
| 1915 VisitForStackValue( | 1910 VisitForStackValue( |
| 1916 property->obj()->AsSuperPropertyReference()->this_var()); | 1911 property->obj()->AsSuperPropertyReference()->this_var()); |
| 1917 VisitForAccumulatorValue( | 1912 VisitForAccumulatorValue( |
| 1918 property->obj()->AsSuperPropertyReference()->home_object_var()); | 1913 property->obj()->AsSuperPropertyReference()->home_object()); |
| 1919 __ push(result_register()); | 1914 __ push(result_register()); |
| 1920 if (expr->is_compound()) { | 1915 if (expr->is_compound()) { |
| 1921 __ push(MemOperand(esp, kPointerSize)); | 1916 __ push(MemOperand(esp, kPointerSize)); |
| 1922 __ push(result_register()); | 1917 __ push(result_register()); |
| 1923 } | 1918 } |
| 1924 break; | 1919 break; |
| 1925 case NAMED_PROPERTY: | 1920 case NAMED_PROPERTY: |
| 1926 if (expr->is_compound()) { | 1921 if (expr->is_compound()) { |
| 1927 // We need the receiver both on the stack and in the register. | 1922 // We need the receiver both on the stack and in the register. |
| 1928 VisitForStackValue(property->obj()); | 1923 VisitForStackValue(property->obj()); |
| 1929 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); | 1924 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); |
| 1930 } else { | 1925 } else { |
| 1931 VisitForStackValue(property->obj()); | 1926 VisitForStackValue(property->obj()); |
| 1932 } | 1927 } |
| 1933 break; | 1928 break; |
| 1934 case KEYED_SUPER_PROPERTY: | 1929 case KEYED_SUPER_PROPERTY: |
| 1935 VisitForStackValue( | 1930 VisitForStackValue( |
| 1936 property->obj()->AsSuperPropertyReference()->this_var()); | 1931 property->obj()->AsSuperPropertyReference()->this_var()); |
| 1937 VisitForStackValue( | 1932 VisitForStackValue( |
| 1938 property->obj()->AsSuperPropertyReference()->home_object_var()); | 1933 property->obj()->AsSuperPropertyReference()->home_object()); |
| 1939 VisitForAccumulatorValue(property->key()); | 1934 VisitForAccumulatorValue(property->key()); |
| 1940 __ Push(result_register()); | 1935 __ Push(result_register()); |
| 1941 if (expr->is_compound()) { | 1936 if (expr->is_compound()) { |
| 1942 __ push(MemOperand(esp, 2 * kPointerSize)); | 1937 __ push(MemOperand(esp, 2 * kPointerSize)); |
| 1943 __ push(MemOperand(esp, 2 * kPointerSize)); | 1938 __ push(MemOperand(esp, 2 * kPointerSize)); |
| 1944 __ push(result_register()); | 1939 __ push(result_register()); |
| 1945 } | 1940 } |
| 1946 break; | 1941 break; |
| 1947 case KEYED_PROPERTY: { | 1942 case KEYED_PROPERTY: { |
| 1948 if (expr->is_compound()) { | 1943 if (expr->is_compound()) { |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2555 __ mov(StoreDescriptor::NameRegister(), | 2550 __ mov(StoreDescriptor::NameRegister(), |
| 2556 prop->key()->AsLiteral()->value()); | 2551 prop->key()->AsLiteral()->value()); |
| 2557 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2552 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
| 2558 CallStoreIC(); | 2553 CallStoreIC(); |
| 2559 break; | 2554 break; |
| 2560 } | 2555 } |
| 2561 case NAMED_SUPER_PROPERTY: { | 2556 case NAMED_SUPER_PROPERTY: { |
| 2562 __ push(eax); | 2557 __ push(eax); |
| 2563 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 2558 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
| 2564 VisitForAccumulatorValue( | 2559 VisitForAccumulatorValue( |
| 2565 prop->obj()->AsSuperPropertyReference()->home_object_var()); | 2560 prop->obj()->AsSuperPropertyReference()->home_object()); |
| 2566 // stack: value, this; eax: home_object | 2561 // stack: value, this; eax: home_object |
| 2567 Register scratch = ecx; | 2562 Register scratch = ecx; |
| 2568 Register scratch2 = edx; | 2563 Register scratch2 = edx; |
| 2569 __ mov(scratch, result_register()); // home_object | 2564 __ mov(scratch, result_register()); // home_object |
| 2570 __ mov(eax, MemOperand(esp, kPointerSize)); // value | 2565 __ mov(eax, MemOperand(esp, kPointerSize)); // value |
| 2571 __ mov(scratch2, MemOperand(esp, 0)); // this | 2566 __ mov(scratch2, MemOperand(esp, 0)); // this |
| 2572 __ mov(MemOperand(esp, kPointerSize), scratch2); // this | 2567 __ mov(MemOperand(esp, kPointerSize), scratch2); // this |
| 2573 __ mov(MemOperand(esp, 0), scratch); // home_object | 2568 __ mov(MemOperand(esp, 0), scratch); // home_object |
| 2574 // stack: this, home_object. eax: value | 2569 // stack: this, home_object. eax: value |
| 2575 EmitNamedSuperPropertyStore(prop); | 2570 EmitNamedSuperPropertyStore(prop); |
| 2576 break; | 2571 break; |
| 2577 } | 2572 } |
| 2578 case KEYED_SUPER_PROPERTY: { | 2573 case KEYED_SUPER_PROPERTY: { |
| 2579 __ push(eax); | 2574 __ push(eax); |
| 2580 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 2575 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
| 2581 VisitForStackValue( | 2576 VisitForStackValue( |
| 2582 prop->obj()->AsSuperPropertyReference()->home_object_var()); | 2577 prop->obj()->AsSuperPropertyReference()->home_object()); |
| 2583 VisitForAccumulatorValue(prop->key()); | 2578 VisitForAccumulatorValue(prop->key()); |
| 2584 Register scratch = ecx; | 2579 Register scratch = ecx; |
| 2585 Register scratch2 = edx; | 2580 Register scratch2 = edx; |
| 2586 __ mov(scratch2, MemOperand(esp, 2 * kPointerSize)); // value | 2581 __ mov(scratch2, MemOperand(esp, 2 * kPointerSize)); // value |
| 2587 // stack: value, this, home_object; eax: key, edx: value | 2582 // stack: value, this, home_object; eax: key, edx: value |
| 2588 __ mov(scratch, MemOperand(esp, kPointerSize)); // this | 2583 __ mov(scratch, MemOperand(esp, kPointerSize)); // this |
| 2589 __ mov(MemOperand(esp, 2 * kPointerSize), scratch); | 2584 __ mov(MemOperand(esp, 2 * kPointerSize), scratch); |
| 2590 __ mov(scratch, MemOperand(esp, 0)); // home_object | 2585 __ mov(scratch, MemOperand(esp, 0)); // home_object |
| 2591 __ mov(MemOperand(esp, kPointerSize), scratch); | 2586 __ mov(MemOperand(esp, kPointerSize), scratch); |
| 2592 __ mov(MemOperand(esp, 0), eax); | 2587 __ mov(MemOperand(esp, 0), eax); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2796 Expression* key = expr->key(); | 2791 Expression* key = expr->key(); |
| 2797 | 2792 |
| 2798 if (key->IsPropertyName()) { | 2793 if (key->IsPropertyName()) { |
| 2799 if (!expr->IsSuperAccess()) { | 2794 if (!expr->IsSuperAccess()) { |
| 2800 VisitForAccumulatorValue(expr->obj()); | 2795 VisitForAccumulatorValue(expr->obj()); |
| 2801 __ Move(LoadDescriptor::ReceiverRegister(), result_register()); | 2796 __ Move(LoadDescriptor::ReceiverRegister(), result_register()); |
| 2802 EmitNamedPropertyLoad(expr); | 2797 EmitNamedPropertyLoad(expr); |
| 2803 } else { | 2798 } else { |
| 2804 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); | 2799 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
| 2805 VisitForStackValue( | 2800 VisitForStackValue( |
| 2806 expr->obj()->AsSuperPropertyReference()->home_object_var()); | 2801 expr->obj()->AsSuperPropertyReference()->home_object()); |
| 2807 EmitNamedSuperPropertyLoad(expr); | 2802 EmitNamedSuperPropertyLoad(expr); |
| 2808 } | 2803 } |
| 2809 } else { | 2804 } else { |
| 2810 if (!expr->IsSuperAccess()) { | 2805 if (!expr->IsSuperAccess()) { |
| 2811 VisitForStackValue(expr->obj()); | 2806 VisitForStackValue(expr->obj()); |
| 2812 VisitForAccumulatorValue(expr->key()); | 2807 VisitForAccumulatorValue(expr->key()); |
| 2813 __ pop(LoadDescriptor::ReceiverRegister()); // Object. | 2808 __ pop(LoadDescriptor::ReceiverRegister()); // Object. |
| 2814 __ Move(LoadDescriptor::NameRegister(), result_register()); // Key. | 2809 __ Move(LoadDescriptor::NameRegister(), result_register()); // Key. |
| 2815 EmitKeyedPropertyLoad(expr); | 2810 EmitKeyedPropertyLoad(expr); |
| 2816 } else { | 2811 } else { |
| 2817 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); | 2812 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
| 2818 VisitForStackValue( | 2813 VisitForStackValue( |
| 2819 expr->obj()->AsSuperPropertyReference()->home_object_var()); | 2814 expr->obj()->AsSuperPropertyReference()->home_object()); |
| 2820 VisitForStackValue(expr->key()); | 2815 VisitForStackValue(expr->key()); |
| 2821 EmitKeyedSuperPropertyLoad(expr); | 2816 EmitKeyedSuperPropertyLoad(expr); |
| 2822 } | 2817 } |
| 2823 } | 2818 } |
| 2824 PrepareForBailoutForId(expr->LoadId(), TOS_REG); | 2819 PrepareForBailoutForId(expr->LoadId(), TOS_REG); |
| 2825 context()->Plug(eax); | 2820 context()->Plug(eax); |
| 2826 } | 2821 } |
| 2827 | 2822 |
| 2828 | 2823 |
| 2829 void FullCodeGenerator::CallIC(Handle<Code> code, | 2824 void FullCodeGenerator::CallIC(Handle<Code> code, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2868 Expression* callee = expr->expression(); | 2863 Expression* callee = expr->expression(); |
| 2869 DCHECK(callee->IsProperty()); | 2864 DCHECK(callee->IsProperty()); |
| 2870 Property* prop = callee->AsProperty(); | 2865 Property* prop = callee->AsProperty(); |
| 2871 DCHECK(prop->IsSuperAccess()); | 2866 DCHECK(prop->IsSuperAccess()); |
| 2872 | 2867 |
| 2873 SetSourcePosition(prop->position()); | 2868 SetSourcePosition(prop->position()); |
| 2874 Literal* key = prop->key()->AsLiteral(); | 2869 Literal* key = prop->key()->AsLiteral(); |
| 2875 DCHECK(!key->value()->IsSmi()); | 2870 DCHECK(!key->value()->IsSmi()); |
| 2876 // Load the function from the receiver. | 2871 // Load the function from the receiver. |
| 2877 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2872 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
| 2878 VisitForStackValue(super_ref->home_object_var()); | 2873 VisitForStackValue(super_ref->home_object()); |
| 2879 VisitForAccumulatorValue(super_ref->this_var()); | 2874 VisitForAccumulatorValue(super_ref->this_var()); |
| 2880 __ push(eax); | 2875 __ push(eax); |
| 2881 __ push(eax); | 2876 __ push(eax); |
| 2882 __ push(Operand(esp, kPointerSize * 2)); | 2877 __ push(Operand(esp, kPointerSize * 2)); |
| 2883 __ push(Immediate(key->value())); | 2878 __ push(Immediate(key->value())); |
| 2884 // Stack here: | 2879 // Stack here: |
| 2885 // - home_object | 2880 // - home_object |
| 2886 // - this (receiver) | 2881 // - this (receiver) |
| 2887 // - this (receiver) <-- LoadFromSuper will pop here and below. | 2882 // - this (receiver) <-- LoadFromSuper will pop here and below. |
| 2888 // - home_object | 2883 // - home_object |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2924 | 2919 |
| 2925 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { | 2920 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
| 2926 Expression* callee = expr->expression(); | 2921 Expression* callee = expr->expression(); |
| 2927 DCHECK(callee->IsProperty()); | 2922 DCHECK(callee->IsProperty()); |
| 2928 Property* prop = callee->AsProperty(); | 2923 Property* prop = callee->AsProperty(); |
| 2929 DCHECK(prop->IsSuperAccess()); | 2924 DCHECK(prop->IsSuperAccess()); |
| 2930 | 2925 |
| 2931 SetSourcePosition(prop->position()); | 2926 SetSourcePosition(prop->position()); |
| 2932 // Load the function from the receiver. | 2927 // Load the function from the receiver. |
| 2933 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2928 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
| 2934 VisitForStackValue(super_ref->home_object_var()); | 2929 VisitForStackValue(super_ref->home_object()); |
| 2935 VisitForAccumulatorValue(super_ref->this_var()); | 2930 VisitForAccumulatorValue(super_ref->this_var()); |
| 2936 __ push(eax); | 2931 __ push(eax); |
| 2937 __ push(eax); | 2932 __ push(eax); |
| 2938 __ push(Operand(esp, kPointerSize * 2)); | 2933 __ push(Operand(esp, kPointerSize * 2)); |
| 2939 VisitForStackValue(prop->key()); | 2934 VisitForStackValue(prop->key()); |
| 2940 // Stack here: | 2935 // Stack here: |
| 2941 // - home_object | 2936 // - home_object |
| 2942 // - this (receiver) | 2937 // - this (receiver) |
| 2943 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | 2938 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
| 2944 // - home_object | 2939 // - home_object |
| (...skipping 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4801 // Put the object both on the stack and in the register. | 4796 // Put the object both on the stack and in the register. |
| 4802 VisitForStackValue(prop->obj()); | 4797 VisitForStackValue(prop->obj()); |
| 4803 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); | 4798 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); |
| 4804 EmitNamedPropertyLoad(prop); | 4799 EmitNamedPropertyLoad(prop); |
| 4805 break; | 4800 break; |
| 4806 } | 4801 } |
| 4807 | 4802 |
| 4808 case NAMED_SUPER_PROPERTY: { | 4803 case NAMED_SUPER_PROPERTY: { |
| 4809 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 4804 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
| 4810 VisitForAccumulatorValue( | 4805 VisitForAccumulatorValue( |
| 4811 prop->obj()->AsSuperPropertyReference()->home_object_var()); | 4806 prop->obj()->AsSuperPropertyReference()->home_object()); |
| 4812 __ push(result_register()); | 4807 __ push(result_register()); |
| 4813 __ push(MemOperand(esp, kPointerSize)); | 4808 __ push(MemOperand(esp, kPointerSize)); |
| 4814 __ push(result_register()); | 4809 __ push(result_register()); |
| 4815 EmitNamedSuperPropertyLoad(prop); | 4810 EmitNamedSuperPropertyLoad(prop); |
| 4816 break; | 4811 break; |
| 4817 } | 4812 } |
| 4818 | 4813 |
| 4819 case KEYED_SUPER_PROPERTY: { | 4814 case KEYED_SUPER_PROPERTY: { |
| 4820 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 4815 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
| 4821 VisitForStackValue( | 4816 VisitForStackValue( |
| 4822 prop->obj()->AsSuperPropertyReference()->home_object_var()); | 4817 prop->obj()->AsSuperPropertyReference()->home_object()); |
| 4823 VisitForAccumulatorValue(prop->key()); | 4818 VisitForAccumulatorValue(prop->key()); |
| 4824 __ push(result_register()); | 4819 __ push(result_register()); |
| 4825 __ push(MemOperand(esp, 2 * kPointerSize)); | 4820 __ push(MemOperand(esp, 2 * kPointerSize)); |
| 4826 __ push(MemOperand(esp, 2 * kPointerSize)); | 4821 __ push(MemOperand(esp, 2 * kPointerSize)); |
| 4827 __ push(result_register()); | 4822 __ push(result_register()); |
| 4828 EmitKeyedSuperPropertyLoad(prop); | 4823 EmitKeyedSuperPropertyLoad(prop); |
| 4829 break; | 4824 break; |
| 4830 } | 4825 } |
| 4831 | 4826 |
| 4832 case KEYED_PROPERTY: { | 4827 case KEYED_PROPERTY: { |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5437 Assembler::target_address_at(call_target_address, | 5432 Assembler::target_address_at(call_target_address, |
| 5438 unoptimized_code)); | 5433 unoptimized_code)); |
| 5439 return OSR_AFTER_STACK_CHECK; | 5434 return OSR_AFTER_STACK_CHECK; |
| 5440 } | 5435 } |
| 5441 | 5436 |
| 5442 | 5437 |
| 5443 } // namespace internal | 5438 } // namespace internal |
| 5444 } // namespace v8 | 5439 } // namespace v8 |
| 5445 | 5440 |
| 5446 #endif // V8_TARGET_ARCH_X87 | 5441 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |