| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 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 28 matching lines...) Expand all Loading... |
| 39 class SafepointGenerator : public CallWrapper { | 39 class SafepointGenerator : public CallWrapper { |
| 40 public: | 40 public: |
| 41 SafepointGenerator(LCodeGen* codegen, | 41 SafepointGenerator(LCodeGen* codegen, |
| 42 LPointerMap* pointers, | 42 LPointerMap* pointers, |
| 43 int deoptimization_index) | 43 int deoptimization_index) |
| 44 : codegen_(codegen), | 44 : codegen_(codegen), |
| 45 pointers_(pointers), | 45 pointers_(pointers), |
| 46 deoptimization_index_(deoptimization_index) { } | 46 deoptimization_index_(deoptimization_index) { } |
| 47 virtual ~SafepointGenerator() { } | 47 virtual ~SafepointGenerator() { } |
| 48 | 48 |
| 49 virtual void BeforeCall(int call_size) { | 49 virtual void BeforeCall(int call_size) const { |
| 50 ASSERT(call_size >= 0); | 50 ASSERT(call_size >= 0); |
| 51 // Ensure that we have enough space after the previous safepoint position | 51 // Ensure that we have enough space after the previous safepoint position |
| 52 // for the generated code there. | 52 // for the generated code there. |
| 53 int call_end = codegen_->masm()->pc_offset() + call_size; | 53 int call_end = codegen_->masm()->pc_offset() + call_size; |
| 54 int prev_jump_end = | 54 int prev_jump_end = |
| 55 codegen_->LastSafepointEnd() + Deoptimizer::patch_size(); | 55 codegen_->LastSafepointEnd() + Deoptimizer::patch_size(); |
| 56 if (call_end < prev_jump_end) { | 56 if (call_end < prev_jump_end) { |
| 57 int padding_size = prev_jump_end - call_end; | 57 int padding_size = prev_jump_end - call_end; |
| 58 ASSERT_EQ(0, padding_size % Assembler::kInstrSize); | 58 ASSERT_EQ(0, padding_size % Assembler::kInstrSize); |
| 59 while (padding_size > 0) { | 59 while (padding_size > 0) { |
| 60 codegen_->masm()->nop(); | 60 codegen_->masm()->nop(); |
| 61 padding_size -= Assembler::kInstrSize; | 61 padding_size -= Assembler::kInstrSize; |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 virtual void AfterCall() { | 66 virtual void AfterCall() const { |
| 67 codegen_->RecordSafepoint(pointers_, deoptimization_index_); | 67 codegen_->RecordSafepoint(pointers_, deoptimization_index_); |
| 68 } | 68 } |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 LCodeGen* codegen_; | 71 LCodeGen* codegen_; |
| 72 LPointerMap* pointers_; | 72 LPointerMap* pointers_; |
| 73 int deoptimization_index_; | 73 int deoptimization_index_; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 | 76 |
| (...skipping 2557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2634 LPointerMap* pointers = instr->pointer_map(); | 2634 LPointerMap* pointers = instr->pointer_map(); |
| 2635 LEnvironment* env = instr->deoptimization_environment(); | 2635 LEnvironment* env = instr->deoptimization_environment(); |
| 2636 RecordPosition(pointers->position()); | 2636 RecordPosition(pointers->position()); |
| 2637 RegisterEnvironmentForDeoptimization(env); | 2637 RegisterEnvironmentForDeoptimization(env); |
| 2638 SafepointGenerator safepoint_generator(this, | 2638 SafepointGenerator safepoint_generator(this, |
| 2639 pointers, | 2639 pointers, |
| 2640 env->deoptimization_index()); | 2640 env->deoptimization_index()); |
| 2641 // The number of arguments is stored in receiver which is r0, as expected | 2641 // The number of arguments is stored in receiver which is r0, as expected |
| 2642 // by InvokeFunction. | 2642 // by InvokeFunction. |
| 2643 v8::internal::ParameterCount actual(receiver); | 2643 v8::internal::ParameterCount actual(receiver); |
| 2644 __ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator); | 2644 __ InvokeFunction(function, actual, CALL_FUNCTION, safepoint_generator); |
| 2645 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2645 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2646 } | 2646 } |
| 2647 | 2647 |
| 2648 | 2648 |
| 2649 void LCodeGen::DoPushArgument(LPushArgument* instr) { | 2649 void LCodeGen::DoPushArgument(LPushArgument* instr) { |
| 2650 LOperand* argument = instr->InputAt(0); | 2650 LOperand* argument = instr->InputAt(0); |
| 2651 if (argument->IsDoubleRegister() || argument->IsDoubleStackSlot()) { | 2651 if (argument->IsDoubleRegister() || argument->IsDoubleStackSlot()) { |
| 2652 Abort("DoPushArgument not implemented for double type."); | 2652 Abort("DoPushArgument not implemented for double type."); |
| 2653 } else { | 2653 } else { |
| 2654 Register argument_reg = EmitLoadRegister(argument, ip); | 2654 Register argument_reg = EmitLoadRegister(argument, ip); |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3077 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { | 3077 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { |
| 3078 ASSERT(ToRegister(instr->function()).is(r1)); | 3078 ASSERT(ToRegister(instr->function()).is(r1)); |
| 3079 ASSERT(instr->HasPointerMap()); | 3079 ASSERT(instr->HasPointerMap()); |
| 3080 ASSERT(instr->HasDeoptimizationEnvironment()); | 3080 ASSERT(instr->HasDeoptimizationEnvironment()); |
| 3081 LPointerMap* pointers = instr->pointer_map(); | 3081 LPointerMap* pointers = instr->pointer_map(); |
| 3082 LEnvironment* env = instr->deoptimization_environment(); | 3082 LEnvironment* env = instr->deoptimization_environment(); |
| 3083 RecordPosition(pointers->position()); | 3083 RecordPosition(pointers->position()); |
| 3084 RegisterEnvironmentForDeoptimization(env); | 3084 RegisterEnvironmentForDeoptimization(env); |
| 3085 SafepointGenerator generator(this, pointers, env->deoptimization_index()); | 3085 SafepointGenerator generator(this, pointers, env->deoptimization_index()); |
| 3086 ParameterCount count(instr->arity()); | 3086 ParameterCount count(instr->arity()); |
| 3087 __ InvokeFunction(r1, count, CALL_FUNCTION, &generator); | 3087 __ InvokeFunction(r1, count, CALL_FUNCTION, generator); |
| 3088 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3088 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 3089 } | 3089 } |
| 3090 | 3090 |
| 3091 | 3091 |
| 3092 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { | 3092 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { |
| 3093 ASSERT(ToRegister(instr->result()).is(r0)); | 3093 ASSERT(ToRegister(instr->result()).is(r0)); |
| 3094 | 3094 |
| 3095 int arity = instr->arity(); | 3095 int arity = instr->arity(); |
| 3096 Handle<Code> ic = | 3096 Handle<Code> ic = |
| 3097 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity, NOT_IN_LOOP); | 3097 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity, NOT_IN_LOOP); |
| (...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4249 __ mov(strict, Operand(Smi::FromInt(strict_mode_flag()))); | 4249 __ mov(strict, Operand(Smi::FromInt(strict_mode_flag()))); |
| 4250 __ Push(object, key, strict); | 4250 __ Push(object, key, strict); |
| 4251 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); | 4251 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); |
| 4252 LPointerMap* pointers = instr->pointer_map(); | 4252 LPointerMap* pointers = instr->pointer_map(); |
| 4253 LEnvironment* env = instr->deoptimization_environment(); | 4253 LEnvironment* env = instr->deoptimization_environment(); |
| 4254 RecordPosition(pointers->position()); | 4254 RecordPosition(pointers->position()); |
| 4255 RegisterEnvironmentForDeoptimization(env); | 4255 RegisterEnvironmentForDeoptimization(env); |
| 4256 SafepointGenerator safepoint_generator(this, | 4256 SafepointGenerator safepoint_generator(this, |
| 4257 pointers, | 4257 pointers, |
| 4258 env->deoptimization_index()); | 4258 env->deoptimization_index()); |
| 4259 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, &safepoint_generator); | 4259 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, safepoint_generator); |
| 4260 } | 4260 } |
| 4261 | 4261 |
| 4262 | 4262 |
| 4263 void LCodeGen::DoIn(LIn* instr) { | 4263 void LCodeGen::DoIn(LIn* instr) { |
| 4264 Register obj = ToRegister(instr->object()); | 4264 Register obj = ToRegister(instr->object()); |
| 4265 Register key = ToRegister(instr->key()); | 4265 Register key = ToRegister(instr->key()); |
| 4266 __ Push(key, obj); | 4266 __ Push(key, obj); |
| 4267 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); | 4267 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); |
| 4268 LPointerMap* pointers = instr->pointer_map(); | 4268 LPointerMap* pointers = instr->pointer_map(); |
| 4269 LEnvironment* env = instr->deoptimization_environment(); | 4269 LEnvironment* env = instr->deoptimization_environment(); |
| 4270 RecordPosition(pointers->position()); | 4270 RecordPosition(pointers->position()); |
| 4271 RegisterEnvironmentForDeoptimization(env); | 4271 RegisterEnvironmentForDeoptimization(env); |
| 4272 SafepointGenerator safepoint_generator(this, | 4272 SafepointGenerator safepoint_generator(this, |
| 4273 pointers, | 4273 pointers, |
| 4274 env->deoptimization_index()); | 4274 env->deoptimization_index()); |
| 4275 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, &safepoint_generator); | 4275 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
| 4276 } | 4276 } |
| 4277 | 4277 |
| 4278 | 4278 |
| 4279 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 4279 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
| 4280 // Perform stack overflow check. | 4280 // Perform stack overflow check. |
| 4281 Label ok; | 4281 Label ok; |
| 4282 __ LoadRoot(ip, Heap::kStackLimitRootIndex); | 4282 __ LoadRoot(ip, Heap::kStackLimitRootIndex); |
| 4283 __ cmp(sp, Operand(ip)); | 4283 __ cmp(sp, Operand(ip)); |
| 4284 __ b(hs, &ok); | 4284 __ b(hs, &ok); |
| 4285 StackCheckStub stub; | 4285 StackCheckStub stub; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 4303 ASSERT(osr_pc_offset_ == -1); | 4303 ASSERT(osr_pc_offset_ == -1); |
| 4304 osr_pc_offset_ = masm()->pc_offset(); | 4304 osr_pc_offset_ = masm()->pc_offset(); |
| 4305 } | 4305 } |
| 4306 | 4306 |
| 4307 | 4307 |
| 4308 | 4308 |
| 4309 | 4309 |
| 4310 #undef __ | 4310 #undef __ |
| 4311 | 4311 |
| 4312 } } // namespace v8::internal | 4312 } } // namespace v8::internal |
| OLD | NEW |