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/ic/call-optimization.h" | 9 #include "src/ic/call-optimization.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 #define __ ACCESS_MASM(masm) | 15 #define __ ACCESS_MASM(masm) |
16 | 16 |
17 | 17 |
18 void ElementHandlerCompiler::GenerateLoadDictionaryElement( | |
19 MacroAssembler* masm) { | |
20 // ----------- S t a t e ------------- | |
21 // -- ecx : key | |
22 // -- edx : receiver | |
23 // -- esp[0] : return address | |
24 // ----------------------------------- | |
25 DCHECK(edx.is(LoadDescriptor::ReceiverRegister())); | |
26 DCHECK(ecx.is(LoadDescriptor::NameRegister())); | |
27 Label slow, miss; | |
28 | |
29 // This stub is meant to be tail-jumped to, the receiver must already | |
30 // have been verified by the caller to not be a smi. | |
31 __ JumpIfNotSmi(ecx, &miss); | |
32 __ mov(ebx, ecx); | |
33 __ SmiUntag(ebx); | |
34 __ mov(eax, FieldOperand(edx, JSObject::kElementsOffset)); | |
35 | |
36 // Push receiver on the stack to free up a register for the dictionary | |
37 // probing. | |
38 __ push(edx); | |
39 __ LoadFromNumberDictionary(&slow, eax, ecx, ebx, edx, edi, eax); | |
40 // Pop receiver before returning. | |
41 __ pop(edx); | |
42 __ ret(0); | |
43 | |
44 __ bind(&slow); | |
45 __ pop(edx); | |
46 | |
47 // ----------- S t a t e ------------- | |
48 // -- ecx : key | |
49 // -- edx : receiver | |
50 // -- esp[0] : return address | |
51 // ----------------------------------- | |
52 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Slow); | |
53 | |
54 __ bind(&miss); | |
55 // ----------- S t a t e ------------- | |
56 // -- ecx : key | |
57 // -- edx : receiver | |
58 // -- esp[0] : return address | |
59 // ----------------------------------- | |
60 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | |
61 } | |
62 | |
63 | |
64 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( | 18 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( |
65 MacroAssembler* masm, Handle<HeapType> type, Register receiver, | 19 MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
66 Handle<JSFunction> getter) { | 20 Handle<JSFunction> getter) { |
67 { | 21 { |
68 FrameScope scope(masm, StackFrame::INTERNAL); | 22 FrameScope scope(masm, StackFrame::INTERNAL); |
69 | 23 |
70 if (!getter.is_null()) { | 24 if (!getter.is_null()) { |
71 // Call the JavaScript getter with the receiver on the stack. | 25 // Call the JavaScript getter with the receiver on the stack. |
72 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 26 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
73 // Swap in the global receiver. | 27 // Swap in the global receiver. |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 // Return the generated code. | 845 // Return the generated code. |
892 return GetCode(kind(), Code::NORMAL, name); | 846 return GetCode(kind(), Code::NORMAL, name); |
893 } | 847 } |
894 | 848 |
895 | 849 |
896 #undef __ | 850 #undef __ |
897 } | 851 } |
898 } // namespace v8::internal | 852 } // namespace v8::internal |
899 | 853 |
900 #endif // V8_TARGET_ARCH_X87 | 854 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |