OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
(...skipping 3475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3486 // Check for the hole value. | 3486 // Check for the hole value. |
3487 if (requires_hole_check) { | 3487 if (requires_hole_check) { |
3488 if (IsFastSmiElementsKind(hinstr->elements_kind())) { | 3488 if (IsFastSmiElementsKind(hinstr->elements_kind())) { |
3489 __ TestIfSmi(result, r0); | 3489 __ TestIfSmi(result, r0); |
3490 DeoptimizeIf(ne, instr, Deoptimizer::kNotASmi, cr0); | 3490 DeoptimizeIf(ne, instr, Deoptimizer::kNotASmi, cr0); |
3491 } else { | 3491 } else { |
3492 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); | 3492 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); |
3493 __ cmp(result, scratch); | 3493 __ cmp(result, scratch); |
3494 DeoptimizeIf(eq, instr, Deoptimizer::kHole); | 3494 DeoptimizeIf(eq, instr, Deoptimizer::kHole); |
3495 } | 3495 } |
| 3496 } else if (instr->hydrogen()->hole_mode() == CONVERT_HOLE_TO_UNDEFINED) { |
| 3497 DCHECK(instr->hydrogen()->elements_kind() == FAST_HOLEY_ELEMENTS); |
| 3498 Label done; |
| 3499 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); |
| 3500 __ cmp(result, scratch); |
| 3501 __ bne(&done); |
| 3502 if (info()->IsStub()) { |
| 3503 // A stub can safely convert the hole to undefined only if the array |
| 3504 // protector cell contains (Smi) Isolate::kArrayProtectorValid. Otherwise |
| 3505 // it needs to bail out. |
| 3506 __ LoadRoot(result, Heap::kArrayProtectorRootIndex); |
| 3507 __ LoadP(result, FieldMemOperand(result, Cell::kValueOffset)); |
| 3508 __ CmpSmiLiteral(result, Smi::FromInt(Isolate::kArrayProtectorValid), r0); |
| 3509 DeoptimizeIf(ne, instr, Deoptimizer::kHole); |
| 3510 } |
| 3511 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); |
| 3512 __ bind(&done); |
3496 } | 3513 } |
3497 } | 3514 } |
3498 | 3515 |
3499 | 3516 |
3500 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { | 3517 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { |
3501 if (instr->is_typed_elements()) { | 3518 if (instr->is_typed_elements()) { |
3502 DoLoadKeyedExternalArray(instr); | 3519 DoLoadKeyedExternalArray(instr); |
3503 } else if (instr->hydrogen()->representation().IsDouble()) { | 3520 } else if (instr->hydrogen()->representation().IsDouble()) { |
3504 DoLoadKeyedFixedDoubleArray(instr); | 3521 DoLoadKeyedFixedDoubleArray(instr); |
3505 } else { | 3522 } else { |
(...skipping 2670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6176 __ Push(scope_info); | 6193 __ Push(scope_info); |
6177 __ push(ToRegister(instr->function())); | 6194 __ push(ToRegister(instr->function())); |
6178 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6195 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6179 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6196 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6180 } | 6197 } |
6181 | 6198 |
6182 | 6199 |
6183 #undef __ | 6200 #undef __ |
6184 } | 6201 } |
6185 } // namespace v8::internal | 6202 } // namespace v8::internal |
OLD | NEW |