OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 Label done; | 82 Label done; |
83 NameDictionaryLookupStub::GenerateNegativeLookup(masm, miss_label, &done, | 83 NameDictionaryLookupStub::GenerateNegativeLookup(masm, miss_label, &done, |
84 properties, name, scratch1); | 84 properties, name, scratch1); |
85 __ bind(&done); | 85 __ bind(&done); |
86 __ DecrementCounter(counters->negative_lookups_miss(), 1); | 86 __ DecrementCounter(counters->negative_lookups_miss(), 1); |
87 } | 87 } |
88 | 88 |
89 | 89 |
90 void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( | 90 void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( |
91 MacroAssembler* masm, int index, Register prototype, Label* miss) { | 91 MacroAssembler* masm, int index, Register prototype, Register scratch, |
| 92 Label* miss) { |
92 // Get the global function with the given index. | 93 // Get the global function with the given index. |
93 Handle<JSFunction> function( | 94 Isolate* isolate = masm->isolate(); |
94 JSFunction::cast(masm->isolate()->native_context()->get(index))); | 95 Handle<JSFunction> jsfunction( |
| 96 JSFunction::cast(isolate->native_context()->get(index))); |
| 97 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(jsfunction); |
95 // Check we're still in the same context. | 98 // Check we're still in the same context. |
96 Register scratch = prototype; | 99 Register function = prototype; |
97 const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); | 100 const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); |
98 __ mov(scratch, Operand(esi, offset)); | 101 __ mov(scratch, Operand(esi, offset)); |
99 __ mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); | 102 __ mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); |
100 __ cmp(Operand(scratch, Context::SlotOffset(index)), function); | 103 __ mov(function, Operand(scratch, Context::SlotOffset(index))); |
| 104 __ CmpWeakValue(function, cell, scratch); |
101 __ j(not_equal, miss); | 105 __ j(not_equal, miss); |
102 | 106 |
103 // Load its initial map. The global functions all have initial maps. | 107 // Load its initial map. The global functions all have initial maps. |
104 __ Move(prototype, Immediate(Handle<Map>(function->initial_map()))); | 108 __ mov(scratch, |
| 109 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
105 // Load the prototype from the initial map. | 110 // Load the prototype from the initial map. |
106 __ mov(prototype, FieldOperand(prototype, Map::kPrototypeOffset)); | 111 __ mov(prototype, FieldOperand(scratch, Map::kPrototypeOffset)); |
107 } | 112 } |
108 | 113 |
109 | 114 |
110 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( | 115 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( |
111 MacroAssembler* masm, Register receiver, Register scratch1, | 116 MacroAssembler* masm, Register receiver, Register scratch1, |
112 Register scratch2, Label* miss_label) { | 117 Register scratch2, Label* miss_label) { |
113 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 118 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
114 __ mov(eax, scratch1); | 119 __ mov(eax, scratch1); |
115 __ ret(0); | 120 __ ret(0); |
116 } | 121 } |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 // Return the generated code. | 710 // Return the generated code. |
706 return GetCode(kind(), Code::NORMAL, name); | 711 return GetCode(kind(), Code::NORMAL, name); |
707 } | 712 } |
708 | 713 |
709 | 714 |
710 #undef __ | 715 #undef __ |
711 } | 716 } |
712 } // namespace v8::internal | 717 } // namespace v8::internal |
713 | 718 |
714 #endif // V8_TARGET_ARCH_IA32 | 719 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |