OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2892 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), | 2892 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), |
2893 SLOPPY, PREMONOMORPHIC).code(); | 2893 SLOPPY, PREMONOMORPHIC).code(); |
2894 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2894 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2895 } | 2895 } |
2896 | 2896 |
2897 | 2897 |
2898 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { | 2898 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { |
2899 DCHECK(ToRegister(instr->context()).is(cp)); | 2899 DCHECK(ToRegister(instr->context()).is(cp)); |
2900 DCHECK(ToRegister(instr->result()).is(v0)); | 2900 DCHECK(ToRegister(instr->result()).is(v0)); |
2901 | 2901 |
2902 __ li(LoadGlobalViaContextDescriptor::DepthRegister(), | 2902 int const slot = instr->slot_index(); |
2903 Operand(Smi::FromInt(instr->depth()))); | 2903 int const depth = instr->depth(); |
2904 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), | 2904 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
2905 Operand(Smi::FromInt(instr->slot_index()))); | 2905 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
2906 __ li(LoadGlobalViaContextDescriptor::NameRegister(), Operand(instr->name())); | 2906 __ li(LoadGlobalViaContextDescriptor::NameRegister(), |
2907 | 2907 Operand(instr->name())); |
2908 Handle<Code> stub = | 2908 Handle<Code> stub = |
2909 CodeFactory::LoadGlobalViaContext(isolate(), instr->depth()).code(); | 2909 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); |
2910 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 2910 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
| 2911 } else { |
| 2912 __ Push(Smi::FromInt(slot)); |
| 2913 __ Push(instr->name()); |
| 2914 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); |
| 2915 } |
2911 } | 2916 } |
2912 | 2917 |
2913 | 2918 |
2914 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2919 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2915 Register context = ToRegister(instr->context()); | 2920 Register context = ToRegister(instr->context()); |
2916 Register result = ToRegister(instr->result()); | 2921 Register result = ToRegister(instr->result()); |
2917 | 2922 |
2918 __ lw(result, ContextOperand(context, instr->slot_index())); | 2923 __ lw(result, ContextOperand(context, instr->slot_index())); |
2919 if (instr->hydrogen()->RequiresHoleCheck()) { | 2924 if (instr->hydrogen()->RequiresHoleCheck()) { |
2920 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 2925 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4202 instr->hydrogen()->initialization_state()).code(); | 4207 instr->hydrogen()->initialization_state()).code(); |
4203 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4208 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4204 } | 4209 } |
4205 | 4210 |
4206 | 4211 |
4207 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { | 4212 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { |
4208 DCHECK(ToRegister(instr->context()).is(cp)); | 4213 DCHECK(ToRegister(instr->context()).is(cp)); |
4209 DCHECK(ToRegister(instr->value()) | 4214 DCHECK(ToRegister(instr->value()) |
4210 .is(StoreGlobalViaContextDescriptor::ValueRegister())); | 4215 .is(StoreGlobalViaContextDescriptor::ValueRegister())); |
4211 | 4216 |
4212 __ li(StoreGlobalViaContextDescriptor::DepthRegister(), | 4217 int const slot = instr->slot_index(); |
4213 Operand(Smi::FromInt(instr->depth()))); | 4218 int const depth = instr->depth(); |
4214 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), | 4219 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
4215 Operand(Smi::FromInt(instr->slot_index()))); | 4220 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
4216 __ li(StoreGlobalViaContextDescriptor::NameRegister(), | 4221 __ li(StoreGlobalViaContextDescriptor::NameRegister(), |
4217 Operand(instr->name())); | 4222 Operand(instr->name())); |
4218 | 4223 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( |
4219 Handle<Code> stub = | 4224 isolate(), depth, instr->language_mode()) |
4220 CodeFactory::StoreGlobalViaContext(isolate(), instr->depth(), | 4225 .code(); |
4221 instr->language_mode()).code(); | 4226 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
4222 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 4227 } else { |
| 4228 __ Push(Smi::FromInt(slot)); |
| 4229 __ Push(instr->name()); |
| 4230 __ Push(StoreGlobalViaContextDescriptor::ValueRegister()); |
| 4231 __ CallRuntime(is_strict(language_mode()) |
| 4232 ? Runtime::kStoreGlobalViaContext_Strict |
| 4233 : Runtime::kStoreGlobalViaContext_Sloppy, |
| 4234 3); |
| 4235 } |
4223 } | 4236 } |
4224 | 4237 |
4225 | 4238 |
4226 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4239 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4227 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; | 4240 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; |
4228 Operand operand(0); | 4241 Operand operand(0); |
4229 Register reg; | 4242 Register reg; |
4230 if (instr->index()->IsConstantOperand()) { | 4243 if (instr->index()->IsConstantOperand()) { |
4231 operand = ToOperand(instr->index()); | 4244 operand = ToOperand(instr->index()); |
4232 reg = ToRegister(instr->length()); | 4245 reg = ToRegister(instr->length()); |
(...skipping 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6079 __ Push(at, ToRegister(instr->function())); | 6092 __ Push(at, ToRegister(instr->function())); |
6080 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6093 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6081 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6094 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6082 } | 6095 } |
6083 | 6096 |
6084 | 6097 |
6085 #undef __ | 6098 #undef __ |
6086 | 6099 |
6087 } // namespace internal | 6100 } // namespace internal |
6088 } // namespace v8 | 6101 } // namespace v8 |
OLD | NEW |