| 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 2561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2572 | 2572 |
| 2573 | 2573 |
| 2574 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, | 2574 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, |
| 2575 Register object, | 2575 Register object, |
| 2576 Handle<Map> type, | 2576 Handle<Map> type, |
| 2577 Handle<String> name, | 2577 Handle<String> name, |
| 2578 LEnvironment* env) { | 2578 LEnvironment* env) { |
| 2579 LookupResult lookup(isolate()); | 2579 LookupResult lookup(isolate()); |
| 2580 type->LookupInDescriptors(NULL, *name, &lookup); | 2580 type->LookupInDescriptors(NULL, *name, &lookup); |
| 2581 ASSERT(lookup.IsFound() || lookup.IsCacheable()); | 2581 ASSERT(lookup.IsFound() || lookup.IsCacheable()); |
| 2582 if (lookup.IsFound() && lookup.type() == FIELD) { | 2582 if (lookup.IsField()) { |
| 2583 int index = lookup.GetLocalFieldIndexFromMap(*type); | 2583 int index = lookup.GetLocalFieldIndexFromMap(*type); |
| 2584 int offset = index * kPointerSize; | 2584 int offset = index * kPointerSize; |
| 2585 if (index < 0) { | 2585 if (index < 0) { |
| 2586 // Negative property indices are in-object properties, indexed | 2586 // Negative property indices are in-object properties, indexed |
| 2587 // from the end of the fixed part of the object. | 2587 // from the end of the fixed part of the object. |
| 2588 __ ldr(result, FieldMemOperand(object, offset + type->instance_size())); | 2588 __ ldr(result, FieldMemOperand(object, offset + type->instance_size())); |
| 2589 } else { | 2589 } else { |
| 2590 // Non-negative property indices are in the properties array. | 2590 // Non-negative property indices are in the properties array. |
| 2591 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 2591 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 2592 __ ldr(result, FieldMemOperand(result, offset + FixedArray::kHeaderSize)); | 2592 __ ldr(result, FieldMemOperand(result, offset + FixedArray::kHeaderSize)); |
| 2593 } | 2593 } |
| 2594 } else if (lookup.IsFound() && lookup.type() == CONSTANT_FUNCTION) { | 2594 } else if (lookup.IsConstantFunction()) { |
| 2595 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type)); | 2595 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type)); |
| 2596 __ LoadHeapObject(result, function); | 2596 __ LoadHeapObject(result, function); |
| 2597 } else { | 2597 } else { |
| 2598 // Negative lookup. | 2598 // Negative lookup. |
| 2599 // Check prototypes. | 2599 // Check prototypes. |
| 2600 Handle<HeapObject> current(HeapObject::cast((*type)->prototype())); | 2600 Handle<HeapObject> current(HeapObject::cast((*type)->prototype())); |
| 2601 Heap* heap = type->GetHeap(); | 2601 Heap* heap = type->GetHeap(); |
| 2602 while (*current != heap->null_value()) { | 2602 while (*current != heap->null_value()) { |
| 2603 __ LoadHeapObject(result, current); | 2603 __ LoadHeapObject(result, current); |
| 2604 __ ldr(result, FieldMemOperand(result, HeapObject::kMapOffset)); | 2604 __ ldr(result, FieldMemOperand(result, HeapObject::kMapOffset)); |
| (...skipping 2795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5400 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 5400 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 5401 __ ldr(result, FieldMemOperand(scratch, | 5401 __ ldr(result, FieldMemOperand(scratch, |
| 5402 FixedArray::kHeaderSize - kPointerSize)); | 5402 FixedArray::kHeaderSize - kPointerSize)); |
| 5403 __ bind(&done); | 5403 __ bind(&done); |
| 5404 } | 5404 } |
| 5405 | 5405 |
| 5406 | 5406 |
| 5407 #undef __ | 5407 #undef __ |
| 5408 | 5408 |
| 5409 } } // namespace v8::internal | 5409 } } // namespace v8::internal |
| OLD | NEW |