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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 if (deopt_jump_table_.length() > 0) { | 327 if (deopt_jump_table_.length() > 0) { |
328 Label needs_frame, call_deopt_entry; | 328 Label needs_frame, call_deopt_entry; |
329 | 329 |
330 Comment(";;; -------------------- Jump table --------------------"); | 330 Comment(";;; -------------------- Jump table --------------------"); |
331 Address base = deopt_jump_table_[0].address; | 331 Address base = deopt_jump_table_[0].address; |
332 | 332 |
333 Register entry_offset = t9; | 333 Register entry_offset = t9; |
334 | 334 |
335 int length = deopt_jump_table_.length(); | 335 int length = deopt_jump_table_.length(); |
336 for (int i = 0; i < length; i++) { | 336 for (int i = 0; i < length; i++) { |
337 __ bind(&deopt_jump_table_[i].label); | 337 Deoptimizer::JumpTableEntry* table_entry = &deopt_jump_table_[i]; |
| 338 __ bind(&table_entry->label); |
338 | 339 |
339 Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type; | 340 Deoptimizer::BailoutType type = table_entry->bailout_type; |
340 DCHECK(type == deopt_jump_table_[0].bailout_type); | 341 DCHECK(type == deopt_jump_table_[0].bailout_type); |
341 Address entry = deopt_jump_table_[i].address; | 342 Address entry = table_entry->address; |
342 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); | 343 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); |
343 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id); | 344 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id); |
344 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); | 345 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); |
| 346 DeoptComment(table_entry->reason); |
345 | 347 |
346 // Second-level deopt table entries are contiguous and small, so instead | 348 // Second-level deopt table entries are contiguous and small, so instead |
347 // of loading the full, absolute address of each one, load an immediate | 349 // of loading the full, absolute address of each one, load an immediate |
348 // offset which will be added to the base address later. | 350 // offset which will be added to the base address later. |
349 __ li(entry_offset, Operand(entry - base)); | 351 __ li(entry_offset, Operand(entry - base)); |
350 | 352 |
351 if (deopt_jump_table_[i].needs_frame) { | 353 if (table_entry->needs_frame) { |
352 DCHECK(!info()->saves_caller_doubles()); | 354 DCHECK(!info()->saves_caller_doubles()); |
353 if (needs_frame.is_bound()) { | 355 if (needs_frame.is_bound()) { |
354 __ Branch(&needs_frame); | 356 __ Branch(&needs_frame); |
355 } else { | 357 } else { |
356 __ bind(&needs_frame); | 358 __ bind(&needs_frame); |
357 Comment(";;; call deopt with frame"); | 359 Comment(";;; call deopt with frame"); |
358 __ MultiPush(cp.bit() | fp.bit() | ra.bit()); | 360 __ MultiPush(cp.bit() | fp.bit() | ra.bit()); |
359 // This variant of deopt can only be used with stubs. Since we don't | 361 // This variant of deopt can only be used with stubs. Since we don't |
360 // have a function pointer to install in the stack frame that we're | 362 // have a function pointer to install in the stack frame that we're |
361 // building, install a special marker there instead. | 363 // building, install a special marker there instead. |
(...skipping 4557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4919 __ mov(input_reg, zero_reg); // In delay slot. | 4921 __ mov(input_reg, zero_reg); // In delay slot. |
4920 | 4922 |
4921 __ bind(&check_bools); | 4923 __ bind(&check_bools); |
4922 __ LoadRoot(at, Heap::kTrueValueRootIndex); | 4924 __ LoadRoot(at, Heap::kTrueValueRootIndex); |
4923 __ Branch(&check_false, ne, scratch2, Operand(at)); | 4925 __ Branch(&check_false, ne, scratch2, Operand(at)); |
4924 __ Branch(USE_DELAY_SLOT, &done); | 4926 __ Branch(USE_DELAY_SLOT, &done); |
4925 __ li(input_reg, Operand(1)); // In delay slot. | 4927 __ li(input_reg, Operand(1)); // In delay slot. |
4926 | 4928 |
4927 __ bind(&check_false); | 4929 __ bind(&check_false); |
4928 __ LoadRoot(at, Heap::kFalseValueRootIndex); | 4930 __ LoadRoot(at, Heap::kFalseValueRootIndex); |
4929 __ RecordComment("Deferred TaggedToI: cannot truncate"); | 4931 DeoptimizeIf(ne, instr, scratch2, Operand(at), "cannot truncate"); |
4930 DeoptimizeIf(ne, instr, scratch2, Operand(at)); | |
4931 __ Branch(USE_DELAY_SLOT, &done); | 4932 __ Branch(USE_DELAY_SLOT, &done); |
4932 __ mov(input_reg, zero_reg); // In delay slot. | 4933 __ mov(input_reg, zero_reg); // In delay slot. |
4933 } else { | 4934 } else { |
4934 __ RecordComment("Deferred TaggedToI: not a heap number"); | 4935 DeoptimizeIf(ne, instr, scratch1, Operand(at), "not a heap number"); |
4935 DeoptimizeIf(ne, instr, scratch1, Operand(at)); | |
4936 | 4936 |
4937 // Load the double value. | 4937 // Load the double value. |
4938 __ ldc1(double_scratch, | 4938 __ ldc1(double_scratch, |
4939 FieldMemOperand(input_reg, HeapNumber::kValueOffset)); | 4939 FieldMemOperand(input_reg, HeapNumber::kValueOffset)); |
4940 | 4940 |
4941 Register except_flag = scratch2; | 4941 Register except_flag = scratch2; |
4942 __ EmitFPUTruncate(kRoundToZero, | 4942 __ EmitFPUTruncate(kRoundToZero, |
4943 input_reg, | 4943 input_reg, |
4944 double_scratch, | 4944 double_scratch, |
4945 scratch1, | 4945 scratch1, |
4946 double_scratch2, | 4946 double_scratch2, |
4947 except_flag, | 4947 except_flag, |
4948 kCheckForInexactConversion); | 4948 kCheckForInexactConversion); |
4949 | 4949 |
4950 __ RecordComment("Deferred TaggedToI: lost precision or NaN"); | 4950 DeoptimizeIf(ne, instr, except_flag, Operand(zero_reg), |
4951 DeoptimizeIf(ne, instr, except_flag, Operand(zero_reg)); | 4951 "lost precision or NaN"); |
4952 | 4952 |
4953 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 4953 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
4954 __ Branch(&done, ne, input_reg, Operand(zero_reg)); | 4954 __ Branch(&done, ne, input_reg, Operand(zero_reg)); |
4955 | 4955 |
4956 __ Mfhc1(scratch1, double_scratch); | 4956 __ Mfhc1(scratch1, double_scratch); |
4957 __ And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); | 4957 __ And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); |
4958 __ RecordComment("Deferred TaggedToI: minus zero"); | 4958 DeoptimizeIf(ne, instr, scratch1, Operand(zero_reg), "minus zero"); |
4959 DeoptimizeIf(ne, instr, scratch1, Operand(zero_reg)); | |
4960 } | 4959 } |
4961 } | 4960 } |
4962 __ bind(&done); | 4961 __ bind(&done); |
4963 } | 4962 } |
4964 | 4963 |
4965 | 4964 |
4966 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4965 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
4967 class DeferredTaggedToI FINAL : public LDeferredCode { | 4966 class DeferredTaggedToI FINAL : public LDeferredCode { |
4968 public: | 4967 public: |
4969 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 4968 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5916 __ li(at, scope_info); | 5915 __ li(at, scope_info); |
5917 __ Push(at, ToRegister(instr->function())); | 5916 __ Push(at, ToRegister(instr->function())); |
5918 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5917 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5919 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5918 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5920 } | 5919 } |
5921 | 5920 |
5922 | 5921 |
5923 #undef __ | 5922 #undef __ |
5924 | 5923 |
5925 } } // namespace v8::internal | 5924 } } // namespace v8::internal |
OLD | NEW |