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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" | 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/builtins/builtins-constructor.h" | 10 #include "src/builtins/builtins-constructor.h" |
(...skipping 2346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2357 } | 2357 } |
2358 | 2358 |
2359 EmitReturn(instr); | 2359 EmitReturn(instr); |
2360 } | 2360 } |
2361 | 2361 |
2362 | 2362 |
2363 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2363 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2364 Register context = ToRegister(instr->context()); | 2364 Register context = ToRegister(instr->context()); |
2365 Register result = ToRegister(instr->result()); | 2365 Register result = ToRegister(instr->result()); |
2366 __ mov(result, ContextOperand(context, instr->slot_index())); | 2366 __ mov(result, ContextOperand(context, instr->slot_index())); |
| 2367 |
| 2368 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2369 __ cmp(result, factory()->the_hole_value()); |
| 2370 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2371 DeoptimizeIf(equal, instr, DeoptimizeReason::kHole); |
| 2372 } else { |
| 2373 Label is_not_hole; |
| 2374 __ j(not_equal, &is_not_hole, Label::kNear); |
| 2375 __ mov(result, factory()->undefined_value()); |
| 2376 __ bind(&is_not_hole); |
| 2377 } |
| 2378 } |
2367 } | 2379 } |
2368 | 2380 |
2369 | 2381 |
2370 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2382 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2371 Register context = ToRegister(instr->context()); | 2383 Register context = ToRegister(instr->context()); |
2372 Register value = ToRegister(instr->value()); | 2384 Register value = ToRegister(instr->value()); |
| 2385 |
| 2386 Label skip_assignment; |
| 2387 |
2373 Operand target = ContextOperand(context, instr->slot_index()); | 2388 Operand target = ContextOperand(context, instr->slot_index()); |
| 2389 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2390 __ cmp(target, factory()->the_hole_value()); |
| 2391 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2392 DeoptimizeIf(equal, instr, DeoptimizeReason::kHole); |
| 2393 } else { |
| 2394 __ j(not_equal, &skip_assignment, Label::kNear); |
| 2395 } |
| 2396 } |
2374 | 2397 |
2375 __ mov(target, value); | 2398 __ mov(target, value); |
2376 if (instr->hydrogen()->NeedsWriteBarrier()) { | 2399 if (instr->hydrogen()->NeedsWriteBarrier()) { |
2377 SmiCheck check_needed = | 2400 SmiCheck check_needed = |
2378 instr->hydrogen()->value()->type().IsHeapObject() | 2401 instr->hydrogen()->value()->type().IsHeapObject() |
2379 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 2402 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
2380 Register temp = ToRegister(instr->temp()); | 2403 Register temp = ToRegister(instr->temp()); |
2381 int offset = Context::SlotOffset(instr->slot_index()); | 2404 int offset = Context::SlotOffset(instr->slot_index()); |
2382 __ RecordWriteContextSlot(context, | 2405 __ RecordWriteContextSlot(context, |
2383 offset, | 2406 offset, |
2384 value, | 2407 value, |
2385 temp, | 2408 temp, |
2386 kSaveFPRegs, | 2409 kSaveFPRegs, |
2387 EMIT_REMEMBERED_SET, | 2410 EMIT_REMEMBERED_SET, |
2388 check_needed); | 2411 check_needed); |
2389 } | 2412 } |
| 2413 |
| 2414 __ bind(&skip_assignment); |
2390 } | 2415 } |
2391 | 2416 |
2392 | 2417 |
2393 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2418 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2394 HObjectAccess access = instr->hydrogen()->access(); | 2419 HObjectAccess access = instr->hydrogen()->access(); |
2395 int offset = access.offset(); | 2420 int offset = access.offset(); |
2396 | 2421 |
2397 if (access.IsExternalMemory()) { | 2422 if (access.IsExternalMemory()) { |
2398 Register result = ToRegister(instr->result()); | 2423 Register result = ToRegister(instr->result()); |
2399 MemOperand operand = instr->object()->IsConstantOperand() | 2424 MemOperand operand = instr->object()->IsConstantOperand() |
(...skipping 2727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5127 __ bind(deferred->exit()); | 5152 __ bind(deferred->exit()); |
5128 __ bind(&done); | 5153 __ bind(&done); |
5129 } | 5154 } |
5130 | 5155 |
5131 #undef __ | 5156 #undef __ |
5132 | 5157 |
5133 } // namespace internal | 5158 } // namespace internal |
5134 } // namespace v8 | 5159 } // namespace v8 |
5135 | 5160 |
5136 #endif // V8_TARGET_ARCH_IA32 | 5161 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |