| 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" |
| (...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 result, Label* miss) { |
| 92 // Get the global function with the given index. | |
| 93 Handle<JSFunction> function( | |
| 94 JSFunction::cast(masm->isolate()->native_context()->get(index))); | |
| 95 // Check we're still in the same context. | |
| 96 Register scratch = prototype; | |
| 97 const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); | 92 const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); |
| 98 __ mov(scratch, Operand(esi, offset)); | 93 __ mov(result, Operand(esi, offset)); |
| 99 __ mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); | 94 __ mov(result, FieldOperand(result, GlobalObject::kNativeContextOffset)); |
| 100 __ cmp(Operand(scratch, Context::SlotOffset(index)), function); | 95 __ mov(result, Operand(result, Context::SlotOffset(index))); |
| 101 __ j(not_equal, miss); | |
| 102 | |
| 103 // Load its initial map. The global functions all have initial maps. | 96 // Load its initial map. The global functions all have initial maps. |
| 104 __ Move(prototype, Immediate(Handle<Map>(function->initial_map()))); | 97 __ mov(result, |
| 98 FieldOperand(result, JSFunction::kPrototypeOrInitialMapOffset)); |
| 105 // Load the prototype from the initial map. | 99 // Load the prototype from the initial map. |
| 106 __ mov(prototype, FieldOperand(prototype, Map::kPrototypeOffset)); | 100 __ mov(result, FieldOperand(result, Map::kPrototypeOffset)); |
| 107 } | 101 } |
| 108 | 102 |
| 109 | 103 |
| 110 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( | 104 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( |
| 111 MacroAssembler* masm, Register receiver, Register scratch1, | 105 MacroAssembler* masm, Register receiver, Register scratch1, |
| 112 Register scratch2, Label* miss_label) { | 106 Register scratch2, Label* miss_label) { |
| 113 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 107 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
| 114 __ mov(eax, scratch1); | 108 __ mov(eax, scratch1); |
| 115 __ ret(0); | 109 __ ret(0); |
| 116 } | 110 } |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 // Return the generated code. | 694 // Return the generated code. |
| 701 return GetCode(kind(), Code::NORMAL, name); | 695 return GetCode(kind(), Code::NORMAL, name); |
| 702 } | 696 } |
| 703 | 697 |
| 704 | 698 |
| 705 #undef __ | 699 #undef __ |
| 706 } | 700 } |
| 707 } // namespace v8::internal | 701 } // namespace v8::internal |
| 708 | 702 |
| 709 #endif // V8_TARGET_ARCH_X87 | 703 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |