Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 10386089: Simplify DoLoadNamedFieldPolymorphic (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2569 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type)); 2580 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type));
2581 __ LoadHeapObject(result, function); 2581 __ LoadHeapObject(result, function);
2582 } 2582 }
2583 } 2583 }
2584 2584
2585 2585
2586 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) { 2586 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) {
2587 Register object = ToRegister(instr->object()); 2587 Register object = ToRegister(instr->object());
2588 Register result = ToRegister(instr->result()); 2588 Register result = ToRegister(instr->result());
2589 Register scratch = scratch0(); 2589 Register scratch = scratch0();
2590
2590 int map_count = instr->hydrogen()->types()->length(); 2591 int map_count = instr->hydrogen()->types()->length();
2592 bool need_generic = instr->hydrogen()->need_generic();
2593
2594 if (map_count == 0 && !need_generic) {
2595 DeoptimizeIf(al, instr->environment());
2596 return;
2597 }
2591 Handle<String> name = instr->hydrogen()->name(); 2598 Handle<String> name = instr->hydrogen()->name();
2592 if (map_count == 0 && instr->hydrogen()->need_generic()) { 2599 Label done;
2593 __ mov(r2, Operand(name)); 2600 __ ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
2594 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); 2601 for (int i = 0; i < map_count; ++i) {
2595 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2602 bool last = (i == map_count - 1);
2596 } else { 2603 Handle<Map> map = instr->hydrogen()->types()->at(i);
2597 Label done; 2604 __ cmp(scratch, Operand(map));
2598 __ ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); 2605 if (last && !need_generic) {
2599 for (int i = 0; i < map_count - 1; ++i) { 2606 DeoptimizeIf(ne, instr->environment());
2600 Handle<Map> map = instr->hydrogen()->types()->at(i); 2607 EmitLoadFieldOrConstantFunction(result, object, map, name);
2608 } else {
2601 Label next; 2609 Label next;
2602 __ cmp(scratch, Operand(map));
2603 __ b(ne, &next); 2610 __ b(ne, &next);
2604 EmitLoadFieldOrConstantFunction(result, object, map, name); 2611 EmitLoadFieldOrConstantFunction(result, object, map, name);
2605 __ b(&done); 2612 __ b(&done);
2606 __ bind(&next); 2613 __ bind(&next);
2607 } 2614 }
2608 if (instr->hydrogen()->need_generic()) {
2609 if (map_count != 0) {
2610 Handle<Map> map = instr->hydrogen()->types()->last();
2611 __ cmp(scratch, Operand(map));
2612 Label generic;
2613 __ b(ne, &generic);
2614 EmitLoadFieldOrConstantFunction(result, object, map, name);
2615 __ b(&done);
2616 __ bind(&generic);
2617 }
2618 __ mov(r2, Operand(name));
2619 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
2620 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2621 } else {
2622 if (map_count != 0) {
2623 Handle<Map> map = instr->hydrogen()->types()->last();
2624 __ cmp(scratch, Operand(map));
2625 DeoptimizeIf(ne, instr->environment());
2626 EmitLoadFieldOrConstantFunction(result, object, map, name);
2627 } else {
2628 DeoptimizeIf(al, instr->environment());
2629 }
2630 }
2631 __ bind(&done);
2632 } 2615 }
2616 if (need_generic) {
2617 __ mov(r2, Operand(name));
2618 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
2619 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2620 }
2621 __ bind(&done);
2633 } 2622 }
2634 2623
2635 2624
2636 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { 2625 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
2637 ASSERT(ToRegister(instr->object()).is(r0)); 2626 ASSERT(ToRegister(instr->object()).is(r0));
2638 ASSERT(ToRegister(instr->result()).is(r0)); 2627 ASSERT(ToRegister(instr->result()).is(r0));
2639 2628
2640 // Name is always in r2. 2629 // Name is always in r2.
2641 __ mov(r2, Operand(instr->name())); 2630 __ mov(r2, Operand(instr->name()));
2642 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); 2631 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
(...skipping 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after
5318 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); 5307 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize));
5319 __ ldr(result, FieldMemOperand(scratch, 5308 __ ldr(result, FieldMemOperand(scratch,
5320 FixedArray::kHeaderSize - kPointerSize)); 5309 FixedArray::kHeaderSize - kPointerSize));
5321 __ bind(&done); 5310 __ bind(&done);
5322 } 5311 }
5323 5312
5324 5313
5325 #undef __ 5314 #undef __
5326 5315
5327 } } // namespace v8::internal 5316 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698