OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/hydrogen-osr.h" | 9 #include "src/hydrogen-osr.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 301 |
302 bool LCodeGen::GenerateJumpTable() { | 302 bool LCodeGen::GenerateJumpTable() { |
303 if (deopt_jump_table_.length() > 0) { | 303 if (deopt_jump_table_.length() > 0) { |
304 Comment(";;; -------------------- Jump table --------------------"); | 304 Comment(";;; -------------------- Jump table --------------------"); |
305 } | 305 } |
306 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); | 306 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); |
307 Label table_start; | 307 Label table_start; |
308 __ bind(&table_start); | 308 __ bind(&table_start); |
309 Label needs_frame; | 309 Label needs_frame; |
310 for (int i = 0; i < deopt_jump_table_.length(); i++) { | 310 for (int i = 0; i < deopt_jump_table_.length(); i++) { |
311 __ bind(&deopt_jump_table_[i].label); | 311 Deoptimizer::JumpTableEntry* table_entry = &deopt_jump_table_[i]; |
312 Address entry = deopt_jump_table_[i].address; | 312 __ bind(&table_entry->label); |
313 Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type; | 313 Address entry = table_entry->address; |
| 314 Deoptimizer::BailoutType type = table_entry->bailout_type; |
314 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); | 315 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); |
315 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id); | 316 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id); |
316 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); | 317 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); |
| 318 DeoptComment(table_entry->reason); |
317 __ li(t9, Operand(ExternalReference::ForDeoptEntry(entry))); | 319 __ li(t9, Operand(ExternalReference::ForDeoptEntry(entry))); |
318 if (deopt_jump_table_[i].needs_frame) { | 320 if (table_entry->needs_frame) { |
319 DCHECK(!info()->saves_caller_doubles()); | 321 DCHECK(!info()->saves_caller_doubles()); |
320 if (needs_frame.is_bound()) { | 322 if (needs_frame.is_bound()) { |
321 __ Branch(&needs_frame); | 323 __ Branch(&needs_frame); |
322 } else { | 324 } else { |
323 __ bind(&needs_frame); | 325 __ bind(&needs_frame); |
324 __ MultiPush(cp.bit() | fp.bit() | ra.bit()); | 326 __ MultiPush(cp.bit() | fp.bit() | ra.bit()); |
325 // This variant of deopt can only be used with stubs. Since we don't | 327 // This variant of deopt can only be used with stubs. Since we don't |
326 // have a function pointer to install in the stack frame that we're | 328 // have a function pointer to install in the stack frame that we're |
327 // building, install a special marker there instead. | 329 // building, install a special marker there instead. |
328 DCHECK(info()->IsStub()); | 330 DCHECK(info()->IsStub()); |
(...skipping 4622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4951 __ mov(input_reg, zero_reg); // In delay slot. | 4953 __ mov(input_reg, zero_reg); // In delay slot. |
4952 | 4954 |
4953 __ bind(&check_bools); | 4955 __ bind(&check_bools); |
4954 __ LoadRoot(at, Heap::kTrueValueRootIndex); | 4956 __ LoadRoot(at, Heap::kTrueValueRootIndex); |
4955 __ Branch(&check_false, ne, scratch2, Operand(at)); | 4957 __ Branch(&check_false, ne, scratch2, Operand(at)); |
4956 __ Branch(USE_DELAY_SLOT, &done); | 4958 __ Branch(USE_DELAY_SLOT, &done); |
4957 __ li(input_reg, Operand(1)); // In delay slot. | 4959 __ li(input_reg, Operand(1)); // In delay slot. |
4958 | 4960 |
4959 __ bind(&check_false); | 4961 __ bind(&check_false); |
4960 __ LoadRoot(at, Heap::kFalseValueRootIndex); | 4962 __ LoadRoot(at, Heap::kFalseValueRootIndex); |
4961 __ RecordComment("Deferred TaggedToI: cannot truncate"); | 4963 DeoptimizeIf(ne, instr, scratch2, Operand(at), "cannot truncate"); |
4962 DeoptimizeIf(ne, instr, scratch2, Operand(at)); | |
4963 __ Branch(USE_DELAY_SLOT, &done); | 4964 __ Branch(USE_DELAY_SLOT, &done); |
4964 __ mov(input_reg, zero_reg); // In delay slot. | 4965 __ mov(input_reg, zero_reg); // In delay slot. |
4965 } else { | 4966 } else { |
4966 __ RecordComment("Deferred TaggedToI: not a heap number"); | 4967 DeoptimizeIf(ne, instr, scratch1, Operand(at), "not a heap number"); |
4967 DeoptimizeIf(ne, instr, scratch1, Operand(at)); | |
4968 | 4968 |
4969 // Load the double value. | 4969 // Load the double value. |
4970 __ ldc1(double_scratch, | 4970 __ ldc1(double_scratch, |
4971 FieldMemOperand(input_reg, HeapNumber::kValueOffset)); | 4971 FieldMemOperand(input_reg, HeapNumber::kValueOffset)); |
4972 | 4972 |
4973 Register except_flag = scratch2; | 4973 Register except_flag = scratch2; |
4974 __ EmitFPUTruncate(kRoundToZero, | 4974 __ EmitFPUTruncate(kRoundToZero, |
4975 input_reg, | 4975 input_reg, |
4976 double_scratch, | 4976 double_scratch, |
4977 scratch1, | 4977 scratch1, |
4978 double_scratch2, | 4978 double_scratch2, |
4979 except_flag, | 4979 except_flag, |
4980 kCheckForInexactConversion); | 4980 kCheckForInexactConversion); |
4981 | 4981 |
4982 __ RecordComment("Deferred TaggedToI: lost precision or NaN"); | 4982 DeoptimizeIf(ne, instr, except_flag, Operand(zero_reg), |
4983 DeoptimizeIf(ne, instr, except_flag, Operand(zero_reg)); | 4983 "lost precision or NaN"); |
4984 | 4984 |
4985 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 4985 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
4986 __ Branch(&done, ne, input_reg, Operand(zero_reg)); | 4986 __ Branch(&done, ne, input_reg, Operand(zero_reg)); |
4987 | 4987 |
4988 __ mfhc1(scratch1, double_scratch); // Get exponent/sign bits. | 4988 __ mfhc1(scratch1, double_scratch); // Get exponent/sign bits. |
4989 __ And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); | 4989 __ And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); |
4990 __ RecordComment("Deferred TaggedToI: minus zero"); | 4990 DeoptimizeIf(ne, instr, scratch1, Operand(zero_reg), "minus zero"); |
4991 DeoptimizeIf(ne, instr, scratch1, Operand(zero_reg)); | |
4992 } | 4991 } |
4993 } | 4992 } |
4994 __ bind(&done); | 4993 __ bind(&done); |
4995 } | 4994 } |
4996 | 4995 |
4997 | 4996 |
4998 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4997 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
4999 class DeferredTaggedToI FINAL : public LDeferredCode { | 4998 class DeferredTaggedToI FINAL : public LDeferredCode { |
5000 public: | 4999 public: |
5001 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 5000 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5947 __ li(at, scope_info); | 5946 __ li(at, scope_info); |
5948 __ Push(at, ToRegister(instr->function())); | 5947 __ Push(at, ToRegister(instr->function())); |
5949 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5948 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5950 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5949 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5951 } | 5950 } |
5952 | 5951 |
5953 | 5952 |
5954 #undef __ | 5953 #undef __ |
5955 | 5954 |
5956 } } // namespace v8::internal | 5955 } } // namespace v8::internal |
OLD | NEW |