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 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
(...skipping 3050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3061 | 3061 |
3062 | 3062 |
3063 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { | 3063 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { |
3064 DCHECK(ToRegister(instr->context()).is(cp)); | 3064 DCHECK(ToRegister(instr->context()).is(cp)); |
3065 DCHECK(ToRegister(instr->result()).is(r3)); | 3065 DCHECK(ToRegister(instr->result()).is(r3)); |
3066 | 3066 |
3067 int const slot = instr->slot_index(); | 3067 int const slot = instr->slot_index(); |
3068 int const depth = instr->depth(); | 3068 int const depth = instr->depth(); |
3069 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | 3069 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
3070 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | 3070 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
3071 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), | |
3072 Operand(instr->name())); | |
3073 Handle<Code> stub = | 3071 Handle<Code> stub = |
3074 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); | 3072 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); |
3075 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 3073 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
3076 } else { | 3074 } else { |
3077 __ Push(Smi::FromInt(slot)); | 3075 __ Push(Smi::FromInt(slot)); |
3078 __ Push(instr->name()); | 3076 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); |
3079 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); | |
3080 } | 3077 } |
3081 } | 3078 } |
3082 | 3079 |
3083 | 3080 |
3084 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 3081 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
3085 Register context = ToRegister(instr->context()); | 3082 Register context = ToRegister(instr->context()); |
3086 Register result = ToRegister(instr->result()); | 3083 Register result = ToRegister(instr->result()); |
3087 __ LoadP(result, ContextOperand(context, instr->slot_index())); | 3084 __ LoadP(result, ContextOperand(context, instr->slot_index())); |
3088 if (instr->hydrogen()->RequiresHoleCheck()) { | 3085 if (instr->hydrogen()->RequiresHoleCheck()) { |
3089 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 3086 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4473 | 4470 |
4474 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { | 4471 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { |
4475 DCHECK(ToRegister(instr->context()).is(cp)); | 4472 DCHECK(ToRegister(instr->context()).is(cp)); |
4476 DCHECK(ToRegister(instr->value()) | 4473 DCHECK(ToRegister(instr->value()) |
4477 .is(StoreGlobalViaContextDescriptor::ValueRegister())); | 4474 .is(StoreGlobalViaContextDescriptor::ValueRegister())); |
4478 | 4475 |
4479 int const slot = instr->slot_index(); | 4476 int const slot = instr->slot_index(); |
4480 int const depth = instr->depth(); | 4477 int const depth = instr->depth(); |
4481 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | 4478 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
4482 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | 4479 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
4483 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), | |
4484 Operand(instr->name())); | |
4485 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( | 4480 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( |
4486 isolate(), depth, instr->language_mode()).code(); | 4481 isolate(), depth, instr->language_mode()).code(); |
4487 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 4482 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
4488 } else { | 4483 } else { |
4489 __ Push(Smi::FromInt(slot)); | 4484 __ Push(Smi::FromInt(slot)); |
4490 __ Push(instr->name()); | |
4491 __ push(StoreGlobalViaContextDescriptor::ValueRegister()); | 4485 __ push(StoreGlobalViaContextDescriptor::ValueRegister()); |
4492 __ CallRuntime(is_strict(instr->language_mode()) | 4486 __ CallRuntime(is_strict(instr->language_mode()) |
4493 ? Runtime::kStoreGlobalViaContext_Strict | 4487 ? Runtime::kStoreGlobalViaContext_Strict |
4494 : Runtime::kStoreGlobalViaContext_Sloppy, | 4488 : Runtime::kStoreGlobalViaContext_Sloppy, |
4495 3); | 4489 2); |
4496 } | 4490 } |
4497 } | 4491 } |
4498 | 4492 |
4499 | 4493 |
4500 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4494 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4501 Representation representation = instr->hydrogen()->length()->representation(); | 4495 Representation representation = instr->hydrogen()->length()->representation(); |
4502 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); | 4496 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); |
4503 DCHECK(representation.IsSmiOrInteger32()); | 4497 DCHECK(representation.IsSmiOrInteger32()); |
4504 | 4498 |
4505 Condition cc = instr->hydrogen()->allow_equality() ? lt : le; | 4499 Condition cc = instr->hydrogen()->allow_equality() ? lt : le; |
(...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6299 __ Push(scope_info); | 6293 __ Push(scope_info); |
6300 __ push(ToRegister(instr->function())); | 6294 __ push(ToRegister(instr->function())); |
6301 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6295 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6302 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6296 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6303 } | 6297 } |
6304 | 6298 |
6305 | 6299 |
6306 #undef __ | 6300 #undef __ |
6307 } // namespace internal | 6301 } // namespace internal |
6308 } // namespace v8 | 6302 } // namespace v8 |
OLD | NEW |