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 #include "src/arm/lithium-codegen-arm.h" | 7 #include "src/arm/lithium-codegen-arm.h" |
8 #include "src/arm/lithium-gap-resolver-arm.h" | 8 #include "src/arm/lithium-gap-resolver-arm.h" |
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 2969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2980 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), | 2980 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), |
2981 SLOPPY, PREMONOMORPHIC).code(); | 2981 SLOPPY, PREMONOMORPHIC).code(); |
2982 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2982 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2983 } | 2983 } |
2984 | 2984 |
2985 | 2985 |
2986 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { | 2986 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { |
2987 DCHECK(ToRegister(instr->context()).is(cp)); | 2987 DCHECK(ToRegister(instr->context()).is(cp)); |
2988 DCHECK(ToRegister(instr->result()).is(r0)); | 2988 DCHECK(ToRegister(instr->result()).is(r0)); |
2989 | 2989 |
2990 __ mov(LoadGlobalViaContextDescriptor::DepthRegister(), | 2990 int const slot = instr->slot_index(); |
2991 Operand(Smi::FromInt(instr->depth()))); | 2991 int const depth = instr->depth(); |
2992 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), | 2992 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
2993 Operand(Smi::FromInt(instr->slot_index()))); | 2993 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
2994 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), | 2994 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), |
2995 Operand(instr->name())); | 2995 Operand(instr->name())); |
2996 | 2996 Handle<Code> stub = |
2997 Handle<Code> stub = | 2997 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); |
2998 CodeFactory::LoadGlobalViaContext(isolate(), instr->depth()).code(); | 2998 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
2999 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 2999 } else { |
| 3000 __ Push(Smi::FromInt(slot)); |
| 3001 __ Push(instr->name()); |
| 3002 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); |
| 3003 } |
3000 } | 3004 } |
3001 | 3005 |
3002 | 3006 |
3003 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 3007 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
3004 Register context = ToRegister(instr->context()); | 3008 Register context = ToRegister(instr->context()); |
3005 Register result = ToRegister(instr->result()); | 3009 Register result = ToRegister(instr->result()); |
3006 __ ldr(result, ContextOperand(context, instr->slot_index())); | 3010 __ ldr(result, ContextOperand(context, instr->slot_index())); |
3007 if (instr->hydrogen()->RequiresHoleCheck()) { | 3011 if (instr->hydrogen()->RequiresHoleCheck()) { |
3008 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 3012 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
3009 __ cmp(result, ip); | 3013 __ cmp(result, ip); |
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4242 instr->hydrogen()->initialization_state()).code(); | 4246 instr->hydrogen()->initialization_state()).code(); |
4243 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 4247 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
4244 } | 4248 } |
4245 | 4249 |
4246 | 4250 |
4247 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { | 4251 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { |
4248 DCHECK(ToRegister(instr->context()).is(cp)); | 4252 DCHECK(ToRegister(instr->context()).is(cp)); |
4249 DCHECK(ToRegister(instr->value()) | 4253 DCHECK(ToRegister(instr->value()) |
4250 .is(StoreGlobalViaContextDescriptor::ValueRegister())); | 4254 .is(StoreGlobalViaContextDescriptor::ValueRegister())); |
4251 | 4255 |
4252 __ mov(StoreGlobalViaContextDescriptor::DepthRegister(), | 4256 int const slot = instr->slot_index(); |
4253 Operand(Smi::FromInt(instr->depth()))); | 4257 int const depth = instr->depth(); |
4254 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), | 4258 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
4255 Operand(Smi::FromInt(instr->slot_index()))); | 4259 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
4256 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), | 4260 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), |
4257 Operand(instr->name())); | 4261 Operand(instr->name())); |
4258 | 4262 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( |
4259 Handle<Code> stub = | 4263 isolate(), depth, instr->language_mode()) |
4260 CodeFactory::StoreGlobalViaContext(isolate(), instr->depth(), | 4264 .code(); |
4261 instr->language_mode()).code(); | 4265 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
4262 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 4266 } else { |
| 4267 __ Push(Smi::FromInt(slot)); |
| 4268 __ Push(instr->name()); |
| 4269 __ push(StoreGlobalViaContextDescriptor::ValueRegister()); |
| 4270 __ CallRuntime(is_strict(instr->language_mode()) |
| 4271 ? Runtime::kStoreGlobalViaContext_Strict |
| 4272 : Runtime::kStoreGlobalViaContext_Sloppy, |
| 4273 3); |
| 4274 } |
4263 } | 4275 } |
4264 | 4276 |
4265 | 4277 |
4266 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4278 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4267 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; | 4279 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; |
4268 if (instr->index()->IsConstantOperand()) { | 4280 if (instr->index()->IsConstantOperand()) { |
4269 Operand index = ToOperand(instr->index()); | 4281 Operand index = ToOperand(instr->index()); |
4270 Register length = ToRegister(instr->length()); | 4282 Register length = ToRegister(instr->length()); |
4271 __ cmp(length, index); | 4283 __ cmp(length, index); |
4272 cc = CommuteCondition(cc); | 4284 cc = CommuteCondition(cc); |
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6037 __ push(ToRegister(instr->function())); | 6049 __ push(ToRegister(instr->function())); |
6038 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6050 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6039 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6051 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6040 } | 6052 } |
6041 | 6053 |
6042 | 6054 |
6043 #undef __ | 6055 #undef __ |
6044 | 6056 |
6045 } // namespace internal | 6057 } // namespace internal |
6046 } // namespace v8 | 6058 } // namespace v8 |
OLD | NEW |