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 2327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 int map_count = instr->hydrogen()->types()->length(); | 2346 int map_count = instr->hydrogen()->types()->length(); |
2347 Handle<String> name = instr->hydrogen()->name(); | 2347 Handle<String> name = instr->hydrogen()->name(); |
2348 if (map_count == 0) { | 2348 if (map_count == 0 && instr->hydrogen()->need_generic()) { |
2349 ASSERT(instr->hydrogen()->need_generic()); | |
2350 __ li(a2, Operand(name)); | 2349 __ li(a2, Operand(name)); |
2351 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2350 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
2352 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2351 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2353 } else { | 2352 } else { |
2354 Label done; | 2353 Label done; |
2355 __ lw(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 2354 __ lw(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
2356 for (int i = 0; i < map_count - 1; ++i) { | 2355 for (int i = 0; i < map_count - 1; ++i) { |
2357 Handle<Map> map = instr->hydrogen()->types()->at(i); | 2356 Handle<Map> map = instr->hydrogen()->types()->at(i); |
2358 Label next; | 2357 Label next; |
2359 __ Branch(&next, ne, scratch, Operand(map)); | 2358 __ Branch(&next, ne, scratch, Operand(map)); |
2360 EmitLoadFieldOrConstantFunction(result, object, map, name); | 2359 EmitLoadFieldOrConstantFunction(result, object, map, name); |
2361 __ Branch(&done); | 2360 __ Branch(&done); |
2362 __ bind(&next); | 2361 __ bind(&next); |
2363 } | 2362 } |
2364 Handle<Map> map = instr->hydrogen()->types()->last(); | |
2365 if (instr->hydrogen()->need_generic()) { | 2363 if (instr->hydrogen()->need_generic()) { |
2366 Label generic; | 2364 if (map_count != 0) { |
2367 __ Branch(&generic, ne, scratch, Operand(map)); | 2365 Handle<Map> map = instr->hydrogen()->types()->last(); |
2368 EmitLoadFieldOrConstantFunction(result, object, map, name); | 2366 Label generic; |
2369 __ Branch(&done); | 2367 __ Branch(&generic, ne, scratch, Operand(map)); |
2370 __ bind(&generic); | 2368 EmitLoadFieldOrConstantFunction(result, object, map, name); |
| 2369 __ Branch(&done); |
| 2370 __ bind(&generic); |
| 2371 } |
2371 __ li(a2, Operand(name)); | 2372 __ li(a2, Operand(name)); |
2372 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2373 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
2373 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2374 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2374 } else { | 2375 } else { |
2375 DeoptimizeIf(ne, instr->environment(), scratch, Operand(map)); | 2376 if (map_count != 0) { |
2376 EmitLoadFieldOrConstantFunction(result, object, map, name); | 2377 Handle<Map> map = instr->hydrogen()->types()->last(); |
| 2378 DeoptimizeIf(ne, instr->environment(), scratch, Operand(map)); |
| 2379 EmitLoadFieldOrConstantFunction(result, object, map, name); |
| 2380 } else { |
| 2381 DeoptimizeIf(al, instr->environment(), zero_reg, Operand(zero_reg)); |
| 2382 } |
2377 } | 2383 } |
2378 __ bind(&done); | 2384 __ bind(&done); |
2379 } | 2385 } |
2380 } | 2386 } |
2381 | 2387 |
2382 | 2388 |
2383 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2389 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
2384 ASSERT(ToRegister(instr->object()).is(a0)); | 2390 ASSERT(ToRegister(instr->object()).is(a0)); |
2385 ASSERT(ToRegister(instr->result()).is(v0)); | 2391 ASSERT(ToRegister(instr->result()).is(v0)); |
2386 | 2392 |
(...skipping 2738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5125 __ Subu(scratch, result, scratch); | 5131 __ Subu(scratch, result, scratch); |
5126 __ lw(result, FieldMemOperand(scratch, | 5132 __ lw(result, FieldMemOperand(scratch, |
5127 FixedArray::kHeaderSize - kPointerSize)); | 5133 FixedArray::kHeaderSize - kPointerSize)); |
5128 __ bind(&done); | 5134 __ bind(&done); |
5129 } | 5135 } |
5130 | 5136 |
5131 | 5137 |
5132 #undef __ | 5138 #undef __ |
5133 | 5139 |
5134 } } // namespace v8::internal | 5140 } } // namespace v8::internal |
OLD | NEW |