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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 HConstant* constant = chunk_->LookupConstant(const_op); | 404 HConstant* constant = chunk_->LookupConstant(const_op); |
405 Handle<Object> literal = constant->handle(); | 405 Handle<Object> literal = constant->handle(); |
406 Representation r = chunk_->LookupLiteralRepresentation(const_op); | 406 Representation r = chunk_->LookupLiteralRepresentation(const_op); |
407 if (r.IsInteger32()) { | 407 if (r.IsInteger32()) { |
408 ASSERT(literal->IsNumber()); | 408 ASSERT(literal->IsNumber()); |
409 __ li(scratch, Operand(static_cast<int32_t>(literal->Number()))); | 409 __ li(scratch, Operand(static_cast<int32_t>(literal->Number()))); |
410 } else if (r.IsDouble()) { | 410 } else if (r.IsDouble()) { |
411 Abort("EmitLoadRegister: Unsupported double immediate."); | 411 Abort("EmitLoadRegister: Unsupported double immediate."); |
412 } else { | 412 } else { |
413 ASSERT(r.IsTagged()); | 413 ASSERT(r.IsTagged()); |
414 if (literal->IsSmi()) { | 414 __ LoadObject(scratch, literal); |
415 __ li(scratch, Operand(literal)); | |
416 } else { | |
417 __ LoadHeapObject(scratch, Handle<HeapObject>::cast(literal)); | |
418 } | |
419 } | 415 } |
420 return scratch; | 416 return scratch; |
421 } else if (op->IsStackSlot() || op->IsArgument()) { | 417 } else if (op->IsStackSlot() || op->IsArgument()) { |
422 __ lw(scratch, ToMemOperand(op)); | 418 __ lw(scratch, ToMemOperand(op)); |
423 return scratch; | 419 return scratch; |
424 } | 420 } |
425 UNREACHABLE(); | 421 UNREACHABLE(); |
426 return scratch; | 422 return scratch; |
427 } | 423 } |
428 | 424 |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 ASSERT(instr->result()->IsDoubleRegister()); | 1617 ASSERT(instr->result()->IsDoubleRegister()); |
1622 DoubleRegister result = ToDoubleRegister(instr->result()); | 1618 DoubleRegister result = ToDoubleRegister(instr->result()); |
1623 double v = instr->value(); | 1619 double v = instr->value(); |
1624 __ Move(result, v); | 1620 __ Move(result, v); |
1625 } | 1621 } |
1626 | 1622 |
1627 | 1623 |
1628 void LCodeGen::DoConstantT(LConstantT* instr) { | 1624 void LCodeGen::DoConstantT(LConstantT* instr) { |
1629 Handle<Object> value = instr->value(); | 1625 Handle<Object> value = instr->value(); |
1630 AllowDeferredHandleDereference smi_check; | 1626 AllowDeferredHandleDereference smi_check; |
1631 if (value->IsSmi()) { | 1627 __ LoadObject(ToRegister(instr->result()), value); |
1632 __ li(ToRegister(instr->result()), Operand(value)); | |
1633 } else { | |
1634 __ LoadHeapObject(ToRegister(instr->result()), | |
1635 Handle<HeapObject>::cast(value)); | |
1636 } | |
1637 } | 1628 } |
1638 | 1629 |
1639 | 1630 |
1640 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { | 1631 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { |
1641 Register result = ToRegister(instr->result()); | 1632 Register result = ToRegister(instr->result()); |
1642 Register map = ToRegister(instr->value()); | 1633 Register map = ToRegister(instr->value()); |
1643 __ EnumLength(result, map); | 1634 __ EnumLength(result, map); |
1644 } | 1635 } |
1645 | 1636 |
1646 | 1637 |
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2879 int offset = index * kPointerSize; | 2870 int offset = index * kPointerSize; |
2880 if (index < 0) { | 2871 if (index < 0) { |
2881 // Negative property indices are in-object properties, indexed | 2872 // Negative property indices are in-object properties, indexed |
2882 // from the end of the fixed part of the object. | 2873 // from the end of the fixed part of the object. |
2883 __ lw(result, FieldMemOperand(object, offset + type->instance_size())); | 2874 __ lw(result, FieldMemOperand(object, offset + type->instance_size())); |
2884 } else { | 2875 } else { |
2885 // Non-negative property indices are in the properties array. | 2876 // Non-negative property indices are in the properties array. |
2886 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 2877 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
2887 __ lw(result, FieldMemOperand(result, offset + FixedArray::kHeaderSize)); | 2878 __ lw(result, FieldMemOperand(result, offset + FixedArray::kHeaderSize)); |
2888 } | 2879 } |
2889 } else if (lookup.IsConstantFunction()) { | 2880 } else if (lookup.IsConstant()) { |
2890 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type)); | 2881 Handle<Object> constant(lookup.GetConstantFromMap(*type), isolate()); |
2891 __ LoadHeapObject(result, function); | 2882 __ LoadObject(result, constant); |
2892 } else { | 2883 } else { |
2893 // Negative lookup. | 2884 // Negative lookup. |
2894 // Check prototypes. | 2885 // Check prototypes. |
2895 Handle<HeapObject> current(HeapObject::cast((*type)->prototype())); | 2886 Handle<HeapObject> current(HeapObject::cast((*type)->prototype())); |
2896 Heap* heap = type->GetHeap(); | 2887 Heap* heap = type->GetHeap(); |
2897 while (*current != heap->null_value()) { | 2888 while (*current != heap->null_value()) { |
2898 __ LoadHeapObject(result, current); | 2889 __ LoadHeapObject(result, current); |
2899 __ lw(result, FieldMemOperand(result, HeapObject::kMapOffset)); | 2890 __ lw(result, FieldMemOperand(result, HeapObject::kMapOffset)); |
2900 DeoptimizeIf(ne, env, result, Operand(Handle<Map>(current->map()))); | 2891 DeoptimizeIf(ne, env, result, Operand(Handle<Map>(current->map()))); |
2901 current = | 2892 current = |
(...skipping 2912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5814 __ Subu(scratch, result, scratch); | 5805 __ Subu(scratch, result, scratch); |
5815 __ lw(result, FieldMemOperand(scratch, | 5806 __ lw(result, FieldMemOperand(scratch, |
5816 FixedArray::kHeaderSize - kPointerSize)); | 5807 FixedArray::kHeaderSize - kPointerSize)); |
5817 __ bind(&done); | 5808 __ bind(&done); |
5818 } | 5809 } |
5819 | 5810 |
5820 | 5811 |
5821 #undef __ | 5812 #undef __ |
5822 | 5813 |
5823 } } // namespace v8::internal | 5814 } } // namespace v8::internal |
OLD | NEW |