OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 2884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2895 } | 2895 } |
2896 | 2896 |
2897 | 2897 |
2898 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { | 2898 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { |
2899 DCHECK(ToRegister(instr->context()).is(rsi)); | 2899 DCHECK(ToRegister(instr->context()).is(rsi)); |
2900 DCHECK(ToRegister(instr->result()).is(rax)); | 2900 DCHECK(ToRegister(instr->result()).is(rax)); |
2901 int const slot = instr->slot_index(); | 2901 int const slot = instr->slot_index(); |
2902 int const depth = instr->depth(); | 2902 int const depth = instr->depth(); |
2903 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | 2903 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
2904 __ Set(LoadGlobalViaContextDescriptor::SlotRegister(), slot); | 2904 __ Set(LoadGlobalViaContextDescriptor::SlotRegister(), slot); |
2905 __ Move(LoadGlobalViaContextDescriptor::NameRegister(), instr->name()); | |
2906 Handle<Code> stub = | 2905 Handle<Code> stub = |
2907 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); | 2906 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); |
2908 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 2907 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
2909 } else { | 2908 } else { |
2910 __ Push(Smi::FromInt(slot)); | 2909 __ Push(Smi::FromInt(slot)); |
2911 __ Push(instr->name()); | 2910 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); |
2912 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); | |
2913 } | 2911 } |
2914 } | 2912 } |
2915 | 2913 |
2916 | 2914 |
2917 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2915 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2918 Register context = ToRegister(instr->context()); | 2916 Register context = ToRegister(instr->context()); |
2919 Register result = ToRegister(instr->result()); | 2917 Register result = ToRegister(instr->result()); |
2920 __ movp(result, ContextOperand(context, instr->slot_index())); | 2918 __ movp(result, ContextOperand(context, instr->slot_index())); |
2921 if (instr->hydrogen()->RequiresHoleCheck()) { | 2919 if (instr->hydrogen()->RequiresHoleCheck()) { |
2922 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | 2920 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4272 | 4270 |
4273 | 4271 |
4274 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { | 4272 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { |
4275 DCHECK(ToRegister(instr->context()).is(rsi)); | 4273 DCHECK(ToRegister(instr->context()).is(rsi)); |
4276 DCHECK(ToRegister(instr->value()) | 4274 DCHECK(ToRegister(instr->value()) |
4277 .is(StoreGlobalViaContextDescriptor::ValueRegister())); | 4275 .is(StoreGlobalViaContextDescriptor::ValueRegister())); |
4278 int const slot = instr->slot_index(); | 4276 int const slot = instr->slot_index(); |
4279 int const depth = instr->depth(); | 4277 int const depth = instr->depth(); |
4280 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | 4278 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
4281 __ Set(StoreGlobalViaContextDescriptor::SlotRegister(), slot); | 4279 __ Set(StoreGlobalViaContextDescriptor::SlotRegister(), slot); |
4282 __ Move(StoreGlobalViaContextDescriptor::NameRegister(), instr->name()); | |
4283 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( | 4280 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( |
4284 isolate(), depth, instr->language_mode()) | 4281 isolate(), depth, instr->language_mode()) |
4285 .code(); | 4282 .code(); |
4286 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 4283 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
4287 } else { | 4284 } else { |
4288 __ Push(Smi::FromInt(slot)); | 4285 __ Push(Smi::FromInt(slot)); |
4289 __ Push(instr->name()); | |
4290 __ Push(StoreGlobalViaContextDescriptor::ValueRegister()); | 4286 __ Push(StoreGlobalViaContextDescriptor::ValueRegister()); |
4291 __ CallRuntime(is_strict(instr->language_mode()) | 4287 __ CallRuntime(is_strict(instr->language_mode()) |
4292 ? Runtime::kStoreGlobalViaContext_Strict | 4288 ? Runtime::kStoreGlobalViaContext_Strict |
4293 : Runtime::kStoreGlobalViaContext_Sloppy, | 4289 : Runtime::kStoreGlobalViaContext_Sloppy, |
4294 3); | 4290 2); |
4295 } | 4291 } |
4296 } | 4292 } |
4297 | 4293 |
4298 | 4294 |
4299 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4295 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4300 Representation representation = instr->hydrogen()->length()->representation(); | 4296 Representation representation = instr->hydrogen()->length()->representation(); |
4301 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); | 4297 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); |
4302 DCHECK(representation.IsSmiOrInteger32()); | 4298 DCHECK(representation.IsSmiOrInteger32()); |
4303 | 4299 |
4304 Condition cc = instr->hydrogen()->allow_equality() ? below : below_equal; | 4300 Condition cc = instr->hydrogen()->allow_equality() ? below : below_equal; |
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6073 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6069 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6074 } | 6070 } |
6075 | 6071 |
6076 | 6072 |
6077 #undef __ | 6073 #undef __ |
6078 | 6074 |
6079 } // namespace internal | 6075 } // namespace internal |
6080 } // namespace v8 | 6076 } // namespace v8 |
6081 | 6077 |
6082 #endif // V8_TARGET_ARCH_X64 | 6078 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |