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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 int num_parameters = scope()->num_parameters(); | 210 int num_parameters = scope()->num_parameters(); |
211 int first_parameter = scope()->has_this_declaration() ? -1 : 0; | 211 int first_parameter = scope()->has_this_declaration() ? -1 : 0; |
212 for (int i = first_parameter; i < num_parameters; i++) { | 212 for (int i = first_parameter; i < num_parameters; i++) { |
213 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); | 213 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
214 if (var->IsContextSlot()) { | 214 if (var->IsContextSlot()) { |
215 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 215 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
216 (num_parameters - 1 - i) * kPointerSize; | 216 (num_parameters - 1 - i) * kPointerSize; |
217 // Load parameter from stack. | 217 // Load parameter from stack. |
218 __ lw(a0, MemOperand(fp, parameter_offset)); | 218 __ lw(a0, MemOperand(fp, parameter_offset)); |
219 // Store it in the context. | 219 // Store it in the context. |
220 MemOperand target = ContextOperand(cp, var->index()); | 220 MemOperand target = ContextMemOperand(cp, var->index()); |
221 __ sw(a0, target); | 221 __ sw(a0, target); |
222 // Update the write barrier. This clobbers a3 and a0. | 222 // Update the write barrier. This clobbers a3 and a0. |
223 if (need_write_barrier) { | 223 if (need_write_barrier) { |
224 __ RecordWriteContextSlot( | 224 __ RecordWriteContextSlot( |
225 cp, target.offset(), a0, a3, GetRAState(), kSaveFPRegs); | 225 cp, target.offset(), a0, a3, GetRAState(), kSaveFPRegs); |
226 } else if (FLAG_debug_code) { | 226 } else if (FLAG_debug_code) { |
227 Label done; | 227 Label done; |
228 __ JumpIfInNewSpace(cp, a0, &done); | 228 __ JumpIfInNewSpace(cp, a0, &done); |
229 __ Abort(kExpectedNewSpaceObject); | 229 __ Abort(kExpectedNewSpaceObject); |
230 __ bind(&done); | 230 __ bind(&done); |
(...skipping 2503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2734 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), | 2734 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), |
2735 SLOPPY, PREMONOMORPHIC).code(); | 2735 SLOPPY, PREMONOMORPHIC).code(); |
2736 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2736 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2737 } | 2737 } |
2738 | 2738 |
2739 | 2739 |
2740 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2740 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2741 Register context = ToRegister(instr->context()); | 2741 Register context = ToRegister(instr->context()); |
2742 Register result = ToRegister(instr->result()); | 2742 Register result = ToRegister(instr->result()); |
2743 | 2743 |
2744 __ lw(result, ContextOperand(context, instr->slot_index())); | 2744 __ lw(result, ContextMemOperand(context, instr->slot_index())); |
2745 if (instr->hydrogen()->RequiresHoleCheck()) { | 2745 if (instr->hydrogen()->RequiresHoleCheck()) { |
2746 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 2746 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
2747 | 2747 |
2748 if (instr->hydrogen()->DeoptimizesOnHole()) { | 2748 if (instr->hydrogen()->DeoptimizesOnHole()) { |
2749 DeoptimizeIf(eq, instr, Deoptimizer::kHole, result, Operand(at)); | 2749 DeoptimizeIf(eq, instr, Deoptimizer::kHole, result, Operand(at)); |
2750 } else { | 2750 } else { |
2751 Label is_not_hole; | 2751 Label is_not_hole; |
2752 __ Branch(&is_not_hole, ne, result, Operand(at)); | 2752 __ Branch(&is_not_hole, ne, result, Operand(at)); |
2753 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); | 2753 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); |
2754 __ bind(&is_not_hole); | 2754 __ bind(&is_not_hole); |
2755 } | 2755 } |
2756 } | 2756 } |
2757 } | 2757 } |
2758 | 2758 |
2759 | 2759 |
2760 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2760 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2761 Register context = ToRegister(instr->context()); | 2761 Register context = ToRegister(instr->context()); |
2762 Register value = ToRegister(instr->value()); | 2762 Register value = ToRegister(instr->value()); |
2763 Register scratch = scratch0(); | 2763 Register scratch = scratch0(); |
2764 MemOperand target = ContextOperand(context, instr->slot_index()); | 2764 MemOperand target = ContextMemOperand(context, instr->slot_index()); |
2765 | 2765 |
2766 Label skip_assignment; | 2766 Label skip_assignment; |
2767 | 2767 |
2768 if (instr->hydrogen()->RequiresHoleCheck()) { | 2768 if (instr->hydrogen()->RequiresHoleCheck()) { |
2769 __ lw(scratch, target); | 2769 __ lw(scratch, target); |
2770 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 2770 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
2771 | 2771 |
2772 if (instr->hydrogen()->DeoptimizesOnHole()) { | 2772 if (instr->hydrogen()->DeoptimizesOnHole()) { |
2773 DeoptimizeIf(eq, instr, Deoptimizer::kHole, scratch, Operand(at)); | 2773 DeoptimizeIf(eq, instr, Deoptimizer::kHole, scratch, Operand(at)); |
2774 } else { | 2774 } else { |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3234 __ SmiTst(receiver, scratch); | 3234 __ SmiTst(receiver, scratch); |
3235 DeoptimizeIf(eq, instr, Deoptimizer::kSmi, scratch, Operand(zero_reg)); | 3235 DeoptimizeIf(eq, instr, Deoptimizer::kSmi, scratch, Operand(zero_reg)); |
3236 | 3236 |
3237 __ GetObjectType(receiver, scratch, scratch); | 3237 __ GetObjectType(receiver, scratch, scratch); |
3238 DeoptimizeIf(lt, instr, Deoptimizer::kNotAJavaScriptObject, scratch, | 3238 DeoptimizeIf(lt, instr, Deoptimizer::kNotAJavaScriptObject, scratch, |
3239 Operand(FIRST_SPEC_OBJECT_TYPE)); | 3239 Operand(FIRST_SPEC_OBJECT_TYPE)); |
3240 | 3240 |
3241 __ Branch(&result_in_receiver); | 3241 __ Branch(&result_in_receiver); |
3242 __ bind(&global_object); | 3242 __ bind(&global_object); |
3243 __ lw(result, FieldMemOperand(function, JSFunction::kContextOffset)); | 3243 __ lw(result, FieldMemOperand(function, JSFunction::kContextOffset)); |
3244 __ lw(result, | 3244 __ lw(result, ContextMemOperand(result, Context::NATIVE_CONTEXT_INDEX)); |
3245 ContextOperand(result, Context::GLOBAL_OBJECT_INDEX)); | 3245 __ lw(result, ContextMemOperand(result, Context::GLOBAL_PROXY_INDEX)); |
3246 __ lw(result, FieldMemOperand(result, JSGlobalObject::kGlobalProxyOffset)); | |
3247 | 3246 |
3248 if (result.is(receiver)) { | 3247 if (result.is(receiver)) { |
3249 __ bind(&result_in_receiver); | 3248 __ bind(&result_in_receiver); |
3250 } else { | 3249 } else { |
3251 Label result_ok; | 3250 Label result_ok; |
3252 __ Branch(&result_ok); | 3251 __ Branch(&result_ok); |
3253 __ bind(&result_in_receiver); | 3252 __ bind(&result_in_receiver); |
3254 __ mov(result, receiver); | 3253 __ mov(result, receiver); |
3255 __ bind(&result_ok); | 3254 __ bind(&result_ok); |
3256 } | 3255 } |
(...skipping 2509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5766 __ Push(at, ToRegister(instr->function())); | 5765 __ Push(at, ToRegister(instr->function())); |
5767 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5766 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5768 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5767 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5769 } | 5768 } |
5770 | 5769 |
5771 | 5770 |
5772 #undef __ | 5771 #undef __ |
5773 | 5772 |
5774 } // namespace internal | 5773 } // namespace internal |
5775 } // namespace v8 | 5774 } // namespace v8 |
OLD | NEW |