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 3024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3035 } | 3035 } |
3036 | 3036 |
3037 __ blr(); | 3037 __ blr(); |
3038 | 3038 |
3039 if (no_frame_start != -1) { | 3039 if (no_frame_start != -1) { |
3040 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 3040 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
3041 } | 3041 } |
3042 } | 3042 } |
3043 | 3043 |
3044 | 3044 |
3045 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { | |
3046 Register result = ToRegister(instr->result()); | |
3047 __ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell().handle()))); | |
3048 __ LoadP(result, FieldMemOperand(ip, Cell::kValueOffset)); | |
3049 if (instr->hydrogen()->RequiresHoleCheck()) { | |
3050 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | |
3051 __ cmp(result, ip); | |
3052 DeoptimizeIf(eq, instr, Deoptimizer::kHole); | |
3053 } | |
3054 } | |
3055 | |
3056 | |
3057 template <class T> | 3045 template <class T> |
3058 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { | 3046 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { |
3059 DCHECK(FLAG_vector_ics); | 3047 DCHECK(FLAG_vector_ics); |
3060 Register vector_register = ToRegister(instr->temp_vector()); | 3048 Register vector_register = ToRegister(instr->temp_vector()); |
3061 Register slot_register = VectorLoadICDescriptor::SlotRegister(); | 3049 Register slot_register = VectorLoadICDescriptor::SlotRegister(); |
3062 DCHECK(vector_register.is(VectorLoadICDescriptor::VectorRegister())); | 3050 DCHECK(vector_register.is(VectorLoadICDescriptor::VectorRegister())); |
3063 DCHECK(slot_register.is(r3)); | 3051 DCHECK(slot_register.is(r3)); |
3064 | 3052 |
3065 AllowDeferredHandleDereference vector_structure_check; | 3053 AllowDeferredHandleDereference vector_structure_check; |
3066 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); | 3054 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); |
(...skipping 15 matching lines...) Expand all Loading... |
3082 if (FLAG_vector_ics) { | 3070 if (FLAG_vector_ics) { |
3083 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 3071 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
3084 } | 3072 } |
3085 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 3073 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
3086 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, | 3074 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, |
3087 PREMONOMORPHIC).code(); | 3075 PREMONOMORPHIC).code(); |
3088 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3076 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3089 } | 3077 } |
3090 | 3078 |
3091 | 3079 |
3092 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | |
3093 Register value = ToRegister(instr->value()); | |
3094 Register cell = scratch0(); | |
3095 | |
3096 // Load the cell. | |
3097 __ mov(cell, Operand(instr->hydrogen()->cell().handle())); | |
3098 | |
3099 // If the cell we are storing to contains the hole it could have | |
3100 // been deleted from the property dictionary. In that case, we need | |
3101 // to update the property details in the property dictionary to mark | |
3102 // it as no longer deleted. | |
3103 if (instr->hydrogen()->RequiresHoleCheck()) { | |
3104 // We use a temp to check the payload (CompareRoot might clobber ip). | |
3105 Register payload = ToRegister(instr->temp()); | |
3106 __ LoadP(payload, FieldMemOperand(cell, Cell::kValueOffset)); | |
3107 __ CompareRoot(payload, Heap::kTheHoleValueRootIndex); | |
3108 DeoptimizeIf(eq, instr, Deoptimizer::kHole); | |
3109 } | |
3110 | |
3111 // Store the value. | |
3112 __ StoreP(value, FieldMemOperand(cell, Cell::kValueOffset), r0); | |
3113 // Cells are always rescanned, so no write barrier here. | |
3114 } | |
3115 | |
3116 | |
3117 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 3080 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
3118 Register context = ToRegister(instr->context()); | 3081 Register context = ToRegister(instr->context()); |
3119 Register result = ToRegister(instr->result()); | 3082 Register result = ToRegister(instr->result()); |
3120 __ LoadP(result, ContextOperand(context, instr->slot_index())); | 3083 __ LoadP(result, ContextOperand(context, instr->slot_index())); |
3121 if (instr->hydrogen()->RequiresHoleCheck()) { | 3084 if (instr->hydrogen()->RequiresHoleCheck()) { |
3122 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 3085 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
3123 if (instr->hydrogen()->DeoptimizesOnHole()) { | 3086 if (instr->hydrogen()->DeoptimizesOnHole()) { |
3124 __ cmp(result, ip); | 3087 __ cmp(result, ip); |
3125 DeoptimizeIf(eq, instr, Deoptimizer::kHole); | 3088 DeoptimizeIf(eq, instr, Deoptimizer::kHole); |
3126 } else { | 3089 } else { |
(...skipping 3103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6230 __ Push(scope_info); | 6193 __ Push(scope_info); |
6231 __ push(ToRegister(instr->function())); | 6194 __ push(ToRegister(instr->function())); |
6232 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6195 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6233 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6196 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6234 } | 6197 } |
6235 | 6198 |
6236 | 6199 |
6237 #undef __ | 6200 #undef __ |
6238 } | 6201 } |
6239 } // namespace v8::internal | 6202 } // namespace v8::internal |
OLD | NEW |