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 2305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2316 | 2316 |
2317 | 2317 |
2318 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, | 2318 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, |
2319 Register object, | 2319 Register object, |
2320 Handle<Map> type, | 2320 Handle<Map> type, |
2321 Handle<String> name, | 2321 Handle<String> name, |
2322 LEnvironment* env) { | 2322 LEnvironment* env) { |
2323 LookupResult lookup(isolate()); | 2323 LookupResult lookup(isolate()); |
2324 type->LookupInDescriptors(NULL, *name, &lookup); | 2324 type->LookupInDescriptors(NULL, *name, &lookup); |
2325 ASSERT(lookup.IsFound() || lookup.IsCacheable()); | 2325 ASSERT(lookup.IsFound() || lookup.IsCacheable()); |
2326 if (lookup.IsFound() && lookup.type() == FIELD) { | 2326 if (lookup.IsField()) { |
2327 int index = lookup.GetLocalFieldIndexFromMap(*type); | 2327 int index = lookup.GetLocalFieldIndexFromMap(*type); |
2328 int offset = index * kPointerSize; | 2328 int offset = index * kPointerSize; |
2329 if (index < 0) { | 2329 if (index < 0) { |
2330 // Negative property indices are in-object properties, indexed | 2330 // Negative property indices are in-object properties, indexed |
2331 // from the end of the fixed part of the object. | 2331 // from the end of the fixed part of the object. |
2332 __ lw(result, FieldMemOperand(object, offset + type->instance_size())); | 2332 __ lw(result, FieldMemOperand(object, offset + type->instance_size())); |
2333 } else { | 2333 } else { |
2334 // Non-negative property indices are in the properties array. | 2334 // Non-negative property indices are in the properties array. |
2335 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 2335 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
2336 __ lw(result, FieldMemOperand(result, offset + FixedArray::kHeaderSize)); | 2336 __ lw(result, FieldMemOperand(result, offset + FixedArray::kHeaderSize)); |
2337 } | 2337 } |
2338 } else if (lookup.IsFound() && lookup.type() == CONSTANT_FUNCTION) { | 2338 } else if (lookup.IsConstantFunction()) { |
2339 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type)); | 2339 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type)); |
2340 __ LoadHeapObject(result, function); | 2340 __ LoadHeapObject(result, function); |
2341 } else { | 2341 } else { |
2342 // Negative lookup. | 2342 // Negative lookup. |
2343 // Check prototypes. | 2343 // Check prototypes. |
2344 Handle<HeapObject> current(HeapObject::cast((*type)->prototype())); | 2344 Handle<HeapObject> current(HeapObject::cast((*type)->prototype())); |
2345 Heap* heap = type->GetHeap(); | 2345 Heap* heap = type->GetHeap(); |
2346 while (*current != heap->null_value()) { | 2346 while (*current != heap->null_value()) { |
2347 __ LoadHeapObject(result, current); | 2347 __ LoadHeapObject(result, current); |
2348 __ lw(result, FieldMemOperand(result, HeapObject::kMapOffset)); | 2348 __ lw(result, FieldMemOperand(result, HeapObject::kMapOffset)); |
(...skipping 2856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5205 __ Subu(scratch, result, scratch); | 5205 __ Subu(scratch, result, scratch); |
5206 __ lw(result, FieldMemOperand(scratch, | 5206 __ lw(result, FieldMemOperand(scratch, |
5207 FixedArray::kHeaderSize - kPointerSize)); | 5207 FixedArray::kHeaderSize - kPointerSize)); |
5208 __ bind(&done); | 5208 __ bind(&done); |
5209 } | 5209 } |
5210 | 5210 |
5211 | 5211 |
5212 #undef __ | 5212 #undef __ |
5213 | 5213 |
5214 } } // namespace v8::internal | 5214 } } // namespace v8::internal |
OLD | NEW |