| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class SafepointGenerator : public CallWrapper { | 42 class SafepointGenerator : public CallWrapper { |
| 43 public: | 43 public: |
| 44 SafepointGenerator(LCodeGen* codegen, | 44 SafepointGenerator(LCodeGen* codegen, |
| 45 LPointerMap* pointers, | 45 LPointerMap* pointers, |
| 46 int deoptimization_index) | 46 int deoptimization_index) |
| 47 : codegen_(codegen), | 47 : codegen_(codegen), |
| 48 pointers_(pointers), | 48 pointers_(pointers), |
| 49 deoptimization_index_(deoptimization_index) { } | 49 deoptimization_index_(deoptimization_index) { } |
| 50 virtual ~SafepointGenerator() { } | 50 virtual ~SafepointGenerator() { } |
| 51 | 51 |
| 52 virtual void BeforeCall(int call_size) { | 52 virtual void BeforeCall(int call_size) const { |
| 53 ASSERT(call_size >= 0); | 53 ASSERT(call_size >= 0); |
| 54 // Ensure that we have enough space after the previous safepoint position | 54 // Ensure that we have enough space after the previous safepoint position |
| 55 // for the jump generated there. | 55 // for the jump generated there. |
| 56 int call_end = codegen_->masm()->pc_offset() + call_size; | 56 int call_end = codegen_->masm()->pc_offset() + call_size; |
| 57 int prev_jump_end = codegen_->LastSafepointEnd() + kMinSafepointSize; | 57 int prev_jump_end = codegen_->LastSafepointEnd() + kMinSafepointSize; |
| 58 if (call_end < prev_jump_end) { | 58 if (call_end < prev_jump_end) { |
| 59 int padding_size = prev_jump_end - call_end; | 59 int padding_size = prev_jump_end - call_end; |
| 60 STATIC_ASSERT(kMinSafepointSize <= 9); // One multibyte nop is enough. | 60 STATIC_ASSERT(kMinSafepointSize <= 9); // One multibyte nop is enough. |
| 61 codegen_->masm()->nop(padding_size); | 61 codegen_->masm()->nop(padding_size); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 virtual void AfterCall() { | 65 virtual void AfterCall() const { |
| 66 codegen_->RecordSafepoint(pointers_, deoptimization_index_); | 66 codegen_->RecordSafepoint(pointers_, deoptimization_index_); |
| 67 } | 67 } |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 static const int kMinSafepointSize = | 70 static const int kMinSafepointSize = |
| 71 MacroAssembler::kShortCallInstructionLength; | 71 MacroAssembler::kShortCallInstructionLength; |
| 72 LCodeGen* codegen_; | 72 LCodeGen* codegen_; |
| 73 LPointerMap* pointers_; | 73 LPointerMap* pointers_; |
| 74 int deoptimization_index_; | 74 int deoptimization_index_; |
| 75 }; | 75 }; |
| (...skipping 2479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2555 __ bind(&invoke); | 2555 __ bind(&invoke); |
| 2556 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); | 2556 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); |
| 2557 LPointerMap* pointers = instr->pointer_map(); | 2557 LPointerMap* pointers = instr->pointer_map(); |
| 2558 LEnvironment* env = instr->deoptimization_environment(); | 2558 LEnvironment* env = instr->deoptimization_environment(); |
| 2559 RecordPosition(pointers->position()); | 2559 RecordPosition(pointers->position()); |
| 2560 RegisterEnvironmentForDeoptimization(env); | 2560 RegisterEnvironmentForDeoptimization(env); |
| 2561 SafepointGenerator safepoint_generator(this, | 2561 SafepointGenerator safepoint_generator(this, |
| 2562 pointers, | 2562 pointers, |
| 2563 env->deoptimization_index()); | 2563 env->deoptimization_index()); |
| 2564 v8::internal::ParameterCount actual(rax); | 2564 v8::internal::ParameterCount actual(rax); |
| 2565 __ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator); | 2565 __ InvokeFunction(function, actual, CALL_FUNCTION, safepoint_generator); |
| 2566 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2566 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 2567 } | 2567 } |
| 2568 | 2568 |
| 2569 | 2569 |
| 2570 void LCodeGen::DoPushArgument(LPushArgument* instr) { | 2570 void LCodeGen::DoPushArgument(LPushArgument* instr) { |
| 2571 LOperand* argument = instr->InputAt(0); | 2571 LOperand* argument = instr->InputAt(0); |
| 2572 EmitPushTaggedOperand(argument); | 2572 EmitPushTaggedOperand(argument); |
| 2573 } | 2573 } |
| 2574 | 2574 |
| 2575 | 2575 |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2962 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { | 2962 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { |
| 2963 ASSERT(ToRegister(instr->function()).is(rdi)); | 2963 ASSERT(ToRegister(instr->function()).is(rdi)); |
| 2964 ASSERT(instr->HasPointerMap()); | 2964 ASSERT(instr->HasPointerMap()); |
| 2965 ASSERT(instr->HasDeoptimizationEnvironment()); | 2965 ASSERT(instr->HasDeoptimizationEnvironment()); |
| 2966 LPointerMap* pointers = instr->pointer_map(); | 2966 LPointerMap* pointers = instr->pointer_map(); |
| 2967 LEnvironment* env = instr->deoptimization_environment(); | 2967 LEnvironment* env = instr->deoptimization_environment(); |
| 2968 RecordPosition(pointers->position()); | 2968 RecordPosition(pointers->position()); |
| 2969 RegisterEnvironmentForDeoptimization(env); | 2969 RegisterEnvironmentForDeoptimization(env); |
| 2970 SafepointGenerator generator(this, pointers, env->deoptimization_index()); | 2970 SafepointGenerator generator(this, pointers, env->deoptimization_index()); |
| 2971 ParameterCount count(instr->arity()); | 2971 ParameterCount count(instr->arity()); |
| 2972 __ InvokeFunction(rdi, count, CALL_FUNCTION, &generator); | 2972 __ InvokeFunction(rdi, count, CALL_FUNCTION, generator); |
| 2973 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2973 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 2974 } | 2974 } |
| 2975 | 2975 |
| 2976 | 2976 |
| 2977 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { | 2977 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { |
| 2978 ASSERT(ToRegister(instr->key()).is(rcx)); | 2978 ASSERT(ToRegister(instr->key()).is(rcx)); |
| 2979 ASSERT(ToRegister(instr->result()).is(rax)); | 2979 ASSERT(ToRegister(instr->result()).is(rax)); |
| 2980 | 2980 |
| 2981 int arity = instr->arity(); | 2981 int arity = instr->arity(); |
| 2982 Handle<Code> ic = isolate()->stub_cache()->ComputeKeyedCallInitialize( | 2982 Handle<Code> ic = isolate()->stub_cache()->ComputeKeyedCallInitialize( |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4039 LEnvironment* env = instr->deoptimization_environment(); | 4039 LEnvironment* env = instr->deoptimization_environment(); |
| 4040 RecordPosition(pointers->position()); | 4040 RecordPosition(pointers->position()); |
| 4041 RegisterEnvironmentForDeoptimization(env); | 4041 RegisterEnvironmentForDeoptimization(env); |
| 4042 // Create safepoint generator that will also ensure enough space in the | 4042 // Create safepoint generator that will also ensure enough space in the |
| 4043 // reloc info for patching in deoptimization (since this is invoking a | 4043 // reloc info for patching in deoptimization (since this is invoking a |
| 4044 // builtin) | 4044 // builtin) |
| 4045 SafepointGenerator safepoint_generator(this, | 4045 SafepointGenerator safepoint_generator(this, |
| 4046 pointers, | 4046 pointers, |
| 4047 env->deoptimization_index()); | 4047 env->deoptimization_index()); |
| 4048 __ Push(Smi::FromInt(strict_mode_flag())); | 4048 __ Push(Smi::FromInt(strict_mode_flag())); |
| 4049 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, &safepoint_generator); | 4049 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, safepoint_generator); |
| 4050 } | 4050 } |
| 4051 | 4051 |
| 4052 | 4052 |
| 4053 void LCodeGen::DoIn(LIn* instr) { | 4053 void LCodeGen::DoIn(LIn* instr) { |
| 4054 LOperand* obj = instr->object(); | 4054 LOperand* obj = instr->object(); |
| 4055 LOperand* key = instr->key(); | 4055 LOperand* key = instr->key(); |
| 4056 EmitPushTaggedOperand(key); | 4056 EmitPushTaggedOperand(key); |
| 4057 EmitPushTaggedOperand(obj); | 4057 EmitPushTaggedOperand(obj); |
| 4058 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); | 4058 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); |
| 4059 LPointerMap* pointers = instr->pointer_map(); | 4059 LPointerMap* pointers = instr->pointer_map(); |
| 4060 LEnvironment* env = instr->deoptimization_environment(); | 4060 LEnvironment* env = instr->deoptimization_environment(); |
| 4061 RecordPosition(pointers->position()); | 4061 RecordPosition(pointers->position()); |
| 4062 RegisterEnvironmentForDeoptimization(env); | 4062 RegisterEnvironmentForDeoptimization(env); |
| 4063 // Create safepoint generator that will also ensure enough space in the | 4063 // Create safepoint generator that will also ensure enough space in the |
| 4064 // reloc info for patching in deoptimization (since this is invoking a | 4064 // reloc info for patching in deoptimization (since this is invoking a |
| 4065 // builtin) | 4065 // builtin) |
| 4066 SafepointGenerator safepoint_generator(this, | 4066 SafepointGenerator safepoint_generator(this, |
| 4067 pointers, | 4067 pointers, |
| 4068 env->deoptimization_index()); | 4068 env->deoptimization_index()); |
| 4069 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, &safepoint_generator); | 4069 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
| 4070 } | 4070 } |
| 4071 | 4071 |
| 4072 | 4072 |
| 4073 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 4073 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
| 4074 // Perform stack overflow check. | 4074 // Perform stack overflow check. |
| 4075 NearLabel done; | 4075 NearLabel done; |
| 4076 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); | 4076 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); |
| 4077 __ j(above_equal, &done); | 4077 __ j(above_equal, &done); |
| 4078 | 4078 |
| 4079 StackCheckStub stub; | 4079 StackCheckStub stub; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 4096 RegisterEnvironmentForDeoptimization(environment); | 4096 RegisterEnvironmentForDeoptimization(environment); |
| 4097 ASSERT(osr_pc_offset_ == -1); | 4097 ASSERT(osr_pc_offset_ == -1); |
| 4098 osr_pc_offset_ = masm()->pc_offset(); | 4098 osr_pc_offset_ = masm()->pc_offset(); |
| 4099 } | 4099 } |
| 4100 | 4100 |
| 4101 #undef __ | 4101 #undef __ |
| 4102 | 4102 |
| 4103 } } // namespace v8::internal | 4103 } } // namespace v8::internal |
| 4104 | 4104 |
| 4105 #endif // V8_TARGET_ARCH_X64 | 4105 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |