OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 6307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6318 | 6318 |
6319 | 6319 |
6320 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) { | 6320 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) { |
6321 Register object = ToRegister(instr->value()); | 6321 Register object = ToRegister(instr->value()); |
6322 __ cmp(ToRegister(instr->map()), | 6322 __ cmp(ToRegister(instr->map()), |
6323 FieldOperand(object, HeapObject::kMapOffset)); | 6323 FieldOperand(object, HeapObject::kMapOffset)); |
6324 DeoptimizeIf(not_equal, instr->environment()); | 6324 DeoptimizeIf(not_equal, instr->environment()); |
6325 } | 6325 } |
6326 | 6326 |
6327 | 6327 |
| 6328 void LCodeGen::DoDeferredLoadMutableDouble(LLoadFieldByIndex* instr, |
| 6329 Register object, |
| 6330 Register index) { |
| 6331 PushSafepointRegistersScope scope(this); |
| 6332 __ push(object); |
| 6333 __ push(index); |
| 6334 __ xor_(esi, esi); |
| 6335 __ CallRuntimeSaveDoubles(Runtime::kLoadMutableDouble); |
| 6336 RecordSafepointWithRegisters( |
| 6337 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); |
| 6338 __ StoreToSafepointRegisterSlot(object, eax); |
| 6339 } |
| 6340 |
| 6341 |
6328 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { | 6342 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { |
| 6343 class DeferredLoadMutableDouble V8_FINAL : public LDeferredCode { |
| 6344 public: |
| 6345 DeferredLoadMutableDouble(LCodeGen* codegen, |
| 6346 LLoadFieldByIndex* instr, |
| 6347 Register object, |
| 6348 Register index, |
| 6349 const X87Stack& x87_stack) |
| 6350 : LDeferredCode(codegen, x87_stack), |
| 6351 instr_(instr), |
| 6352 object_(object), |
| 6353 index_(index) { |
| 6354 } |
| 6355 virtual void Generate() V8_OVERRIDE { |
| 6356 codegen()->DoDeferredLoadMutableDouble(instr_, object_, index_); |
| 6357 } |
| 6358 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
| 6359 private: |
| 6360 LLoadFieldByIndex* instr_; |
| 6361 Register object_; |
| 6362 Register index_; |
| 6363 }; |
| 6364 |
6329 Register object = ToRegister(instr->object()); | 6365 Register object = ToRegister(instr->object()); |
6330 Register index = ToRegister(instr->index()); | 6366 Register index = ToRegister(instr->index()); |
6331 | 6367 |
| 6368 DeferredLoadMutableDouble* deferred; |
| 6369 deferred = new(zone()) DeferredLoadMutableDouble( |
| 6370 this, instr, object, index, x87_stack_); |
| 6371 |
6332 Label out_of_object, done; | 6372 Label out_of_object, done; |
| 6373 __ test(index, Immediate(Smi::FromInt(1))); |
| 6374 __ j(not_zero, deferred->entry()); |
| 6375 |
| 6376 __ sar(index, 1); |
| 6377 |
6333 __ cmp(index, Immediate(0)); | 6378 __ cmp(index, Immediate(0)); |
6334 __ j(less, &out_of_object, Label::kNear); | 6379 __ j(less, &out_of_object, Label::kNear); |
6335 __ mov(object, FieldOperand(object, | 6380 __ mov(object, FieldOperand(object, |
6336 index, | 6381 index, |
6337 times_half_pointer_size, | 6382 times_half_pointer_size, |
6338 JSObject::kHeaderSize)); | 6383 JSObject::kHeaderSize)); |
6339 __ jmp(&done, Label::kNear); | 6384 __ jmp(&done, Label::kNear); |
6340 | 6385 |
6341 __ bind(&out_of_object); | 6386 __ bind(&out_of_object); |
6342 __ mov(object, FieldOperand(object, JSObject::kPropertiesOffset)); | 6387 __ mov(object, FieldOperand(object, JSObject::kPropertiesOffset)); |
6343 __ neg(index); | 6388 __ neg(index); |
6344 // Index is now equal to out of object property index plus 1. | 6389 // Index is now equal to out of object property index plus 1. |
6345 __ mov(object, FieldOperand(object, | 6390 __ mov(object, FieldOperand(object, |
6346 index, | 6391 index, |
6347 times_half_pointer_size, | 6392 times_half_pointer_size, |
6348 FixedArray::kHeaderSize - kPointerSize)); | 6393 FixedArray::kHeaderSize - kPointerSize)); |
| 6394 __ bind(deferred->exit()); |
6349 __ bind(&done); | 6395 __ bind(&done); |
6350 } | 6396 } |
6351 | 6397 |
6352 | 6398 |
6353 #undef __ | 6399 #undef __ |
6354 | 6400 |
6355 } } // namespace v8::internal | 6401 } } // namespace v8::internal |
6356 | 6402 |
6357 #endif // V8_TARGET_ARCH_IA32 | 6403 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |