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 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2336 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type)); | 2336 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type)); |
2337 __ LoadHeapObject(result, function); | 2337 __ LoadHeapObject(result, function); |
2338 } | 2338 } |
2339 } | 2339 } |
2340 | 2340 |
2341 | 2341 |
2342 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) { | 2342 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) { |
2343 Register object = ToRegister(instr->object()); | 2343 Register object = ToRegister(instr->object()); |
2344 Register result = ToRegister(instr->result()); | 2344 Register result = ToRegister(instr->result()); |
2345 Register scratch = scratch0(); | 2345 Register scratch = scratch0(); |
| 2346 |
2346 int map_count = instr->hydrogen()->types()->length(); | 2347 int map_count = instr->hydrogen()->types()->length(); |
2347 bool need_generic = instr->hydrogen()->need_generic(); | 2348 bool need_generic = instr->hydrogen()->need_generic(); |
2348 | 2349 |
2349 if (map_count == 0 && !need_generic) { | 2350 if (map_count == 0 && !need_generic) { |
2350 DeoptimizeIf(al, instr->environment()); | 2351 DeoptimizeIf(al, instr->environment()); |
2351 return; | 2352 return; |
2352 } | 2353 } |
2353 Handle<String> name = instr->hydrogen()->name(); | 2354 Handle<String> name = instr->hydrogen()->name(); |
2354 Label done; | 2355 Label done; |
2355 __ lw(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 2356 __ lw(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
2356 for (int i = 0; i < map_count; ++i) { | 2357 for (int i = 0; i < map_count; ++i) { |
2357 bool last = (i == map_count - 1); | 2358 bool last = (i == map_count - 1); |
2358 Handle<Map> map = instr->hydrogen()->types()->at(i); | 2359 Handle<Map> map = instr->hydrogen()->types()->at(i); |
2359 if (last && !need_generic) { | 2360 if (last && !need_generic) { |
2360 Handle<Map> map = instr->hydrogen()->types()->last(); | |
2361 DeoptimizeIf(ne, instr->environment(), scratch, Operand(map)); | 2361 DeoptimizeIf(ne, instr->environment(), scratch, Operand(map)); |
| 2362 EmitLoadFieldOrConstantFunction(result, object, map, name); |
2362 } else { | 2363 } else { |
2363 Label next; | 2364 Label next; |
2364 __ Branch(&next, ne, scratch, Operand(map)); | 2365 __ Branch(&next, ne, scratch, Operand(map)); |
2365 EmitLoadFieldOrConstantFunction(result, object, map, name); | 2366 EmitLoadFieldOrConstantFunction(result, object, map, name); |
2366 __ Branch(&done); | 2367 __ Branch(&done); |
2367 __ bind(&next); | 2368 __ bind(&next); |
2368 } | 2369 } |
2369 } | 2370 } |
2370 if (need_generic) { | 2371 if (need_generic) { |
2371 __ li(a2, Operand(name)); | 2372 __ li(a2, Operand(name)); |
(...skipping 2749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5121 __ Subu(scratch, result, scratch); | 5122 __ Subu(scratch, result, scratch); |
5122 __ lw(result, FieldMemOperand(scratch, | 5123 __ lw(result, FieldMemOperand(scratch, |
5123 FixedArray::kHeaderSize - kPointerSize)); | 5124 FixedArray::kHeaderSize - kPointerSize)); |
5124 __ bind(&done); | 5125 __ bind(&done); |
5125 } | 5126 } |
5126 | 5127 |
5127 | 5128 |
5128 #undef __ | 5129 #undef __ |
5129 | 5130 |
5130 } } // namespace v8::internal | 5131 } } // namespace v8::internal |
OLD | NEW |