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

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

Issue 6992072: Implement set trap for proxies, and revamp class hierarchy in preparation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review. Created 9 years, 6 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 | « src/arm/ic-arm.cc ('k') | src/arm/macro-assembler-arm.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 1772
1773 // Load map. 1773 // Load map.
1774 __ ldr(temp1, FieldMemOperand(input, HeapObject::kMapOffset)); 1774 __ ldr(temp1, FieldMemOperand(input, HeapObject::kMapOffset));
1775 // Undetectable objects behave like undefined. 1775 // Undetectable objects behave like undefined.
1776 __ ldrb(temp2, FieldMemOperand(temp1, Map::kBitFieldOffset)); 1776 __ ldrb(temp2, FieldMemOperand(temp1, Map::kBitFieldOffset));
1777 __ tst(temp2, Operand(1 << Map::kIsUndetectable)); 1777 __ tst(temp2, Operand(1 << Map::kIsUndetectable));
1778 __ b(ne, is_not_object); 1778 __ b(ne, is_not_object);
1779 1779
1780 // Load instance type and check that it is in object type range. 1780 // Load instance type and check that it is in object type range.
1781 __ ldrb(temp2, FieldMemOperand(temp1, Map::kInstanceTypeOffset)); 1781 __ ldrb(temp2, FieldMemOperand(temp1, Map::kInstanceTypeOffset));
1782 __ cmp(temp2, Operand(FIRST_JS_OBJECT_TYPE)); 1782 __ cmp(temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE));
1783 __ b(lt, is_not_object); 1783 __ b(lt, is_not_object);
1784 __ cmp(temp2, Operand(LAST_JS_OBJECT_TYPE)); 1784 __ cmp(temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE));
1785 return le; 1785 return le;
1786 } 1786 }
1787 1787
1788 1788
1789 void LCodeGen::DoIsObject(LIsObject* instr) { 1789 void LCodeGen::DoIsObject(LIsObject* instr) {
1790 Register reg = ToRegister(instr->InputAt(0)); 1790 Register reg = ToRegister(instr->InputAt(0));
1791 Register result = ToRegister(instr->result()); 1791 Register result = ToRegister(instr->result());
1792 Register temp = scratch0(); 1792 Register temp = scratch0();
1793 Label is_false, is_true, done; 1793 Label is_false, is_true, done;
1794 1794
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 void LCodeGen::EmitClassOfTest(Label* is_true, 1981 void LCodeGen::EmitClassOfTest(Label* is_true,
1982 Label* is_false, 1982 Label* is_false,
1983 Handle<String>class_name, 1983 Handle<String>class_name,
1984 Register input, 1984 Register input,
1985 Register temp, 1985 Register temp,
1986 Register temp2) { 1986 Register temp2) {
1987 ASSERT(!input.is(temp)); 1987 ASSERT(!input.is(temp));
1988 ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register. 1988 ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register.
1989 __ tst(input, Operand(kSmiTagMask)); 1989 __ tst(input, Operand(kSmiTagMask));
1990 __ b(eq, is_false); 1990 __ b(eq, is_false);
1991 __ CompareObjectType(input, temp, temp2, FIRST_JS_OBJECT_TYPE); 1991 __ CompareObjectType(input, temp, temp2, FIRST_SPEC_OBJECT_TYPE);
1992 __ b(lt, is_false); 1992 __ b(lt, is_false);
1993 1993
1994 // Map is now in temp. 1994 // Map is now in temp.
1995 // Functions have class 'Function'. 1995 // Functions have class 'Function'.
1996 __ CompareInstanceType(temp, temp2, JS_FUNCTION_TYPE); 1996 __ CompareInstanceType(temp, temp2, FIRST_CALLABLE_SPEC_OBJECT_TYPE);
1997 if (class_name->IsEqualTo(CStrVector("Function"))) { 1997 if (class_name->IsEqualTo(CStrVector("Function"))) {
1998 __ b(eq, is_true); 1998 __ b(ge, is_true);
1999 } else { 1999 } else {
2000 __ b(eq, is_false); 2000 __ b(ge, is_false);
2001 } 2001 }
2002 2002
2003 // Check if the constructor in the map is a function. 2003 // Check if the constructor in the map is a function.
2004 __ ldr(temp, FieldMemOperand(temp, Map::kConstructorOffset)); 2004 __ ldr(temp, FieldMemOperand(temp, Map::kConstructorOffset));
2005 2005
2006 // As long as JS_FUNCTION_TYPE is the last instance type and it is 2006 // As long as LAST_CALLABLE_SPEC_OBJECT_TYPE is the last instance type and
2007 // right after LAST_JS_OBJECT_TYPE, we can avoid checking for 2007 // FIRST_CALLABLE_SPEC_OBJECT_TYPE comes right after
2008 // LAST_JS_OBJECT_TYPE. 2008 // LAST_NONCALLABLE_SPEC_OBJECT_TYPE, we can avoid checking for the latter.
2009 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); 2009 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE);
2010 ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); 2010 STATIC_ASSERT(FIRST_CALLABLE_SPEC_OBJECT_TYPE ==
2011 LAST_NONCALLABLE_SPEC_OBJECT_TYPE + 1);
2011 2012
2012 // Objects with a non-function constructor have class 'Object'. 2013 // Objects with a non-function constructor have class 'Object'.
2013 __ CompareObjectType(temp, temp2, temp2, JS_FUNCTION_TYPE); 2014 __ CompareObjectType(temp, temp2, temp2, JS_FUNCTION_TYPE);
2014 if (class_name->IsEqualTo(CStrVector("Object"))) { 2015 if (class_name->IsEqualTo(CStrVector("Object"))) {
2015 __ b(ne, is_true); 2016 __ b(ne, is_true);
2016 } else { 2017 } else {
2017 __ b(ne, is_false); 2018 __ b(ne, is_false);
2018 } 2019 }
2019 2020
2020 // temp now contains the constructor function. Grab the 2021 // temp now contains the constructor function. Grab the
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
2736 __ LoadRoot(scratch, Heap::kNullValueRootIndex); 2737 __ LoadRoot(scratch, Heap::kNullValueRootIndex);
2737 __ cmp(receiver, scratch); 2738 __ cmp(receiver, scratch);
2738 __ b(eq, &global_object); 2739 __ b(eq, &global_object);
2739 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); 2740 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
2740 __ cmp(receiver, scratch); 2741 __ cmp(receiver, scratch);
2741 __ b(eq, &global_object); 2742 __ b(eq, &global_object);
2742 2743
2743 // Deoptimize if the receiver is not a JS object. 2744 // Deoptimize if the receiver is not a JS object.
2744 __ tst(receiver, Operand(kSmiTagMask)); 2745 __ tst(receiver, Operand(kSmiTagMask));
2745 DeoptimizeIf(eq, instr->environment()); 2746 DeoptimizeIf(eq, instr->environment());
2746 __ CompareObjectType(receiver, scratch, scratch, FIRST_JS_OBJECT_TYPE); 2747 __ CompareObjectType(receiver, scratch, scratch, FIRST_SPEC_OBJECT_TYPE);
2747 DeoptimizeIf(lo, instr->environment()); 2748 DeoptimizeIf(lt, instr->environment());
2748 __ jmp(&receiver_ok); 2749 __ jmp(&receiver_ok);
2749 2750
2750 __ bind(&global_object); 2751 __ bind(&global_object);
2751 __ ldr(receiver, GlobalObjectOperand()); 2752 __ ldr(receiver, GlobalObjectOperand());
2752 __ ldr(receiver, 2753 __ ldr(receiver,
2753 FieldMemOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); 2754 FieldMemOperand(receiver, JSGlobalObject::kGlobalReceiverOffset));
2754 __ bind(&receiver_ok); 2755 __ bind(&receiver_ok);
2755 2756
2756 // Copy the arguments to this function possibly from the 2757 // Copy the arguments to this function possibly from the
2757 // adaptor frame below it. 2758 // adaptor frame below it.
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after
4395 __ b(eq, true_label); 4396 __ b(eq, true_label);
4396 __ JumpIfSmi(input, false_label); 4397 __ JumpIfSmi(input, false_label);
4397 // Check for undetectable objects => true. 4398 // Check for undetectable objects => true.
4398 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); 4399 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset));
4399 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); 4400 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset));
4400 __ tst(ip, Operand(1 << Map::kIsUndetectable)); 4401 __ tst(ip, Operand(1 << Map::kIsUndetectable));
4401 final_branch_condition = ne; 4402 final_branch_condition = ne;
4402 4403
4403 } else if (type_name->Equals(heap()->function_symbol())) { 4404 } else if (type_name->Equals(heap()->function_symbol())) {
4404 __ JumpIfSmi(input, false_label); 4405 __ JumpIfSmi(input, false_label);
4405 __ CompareObjectType(input, input, scratch, FIRST_FUNCTION_CLASS_TYPE); 4406 __ CompareObjectType(input, input, scratch,
4407 FIRST_CALLABLE_SPEC_OBJECT_TYPE);
4406 final_branch_condition = ge; 4408 final_branch_condition = ge;
4407 4409
4408 } else if (type_name->Equals(heap()->object_symbol())) { 4410 } else if (type_name->Equals(heap()->object_symbol())) {
4409 __ JumpIfSmi(input, false_label); 4411 __ JumpIfSmi(input, false_label);
4410 __ CompareRoot(input, Heap::kNullValueRootIndex); 4412 __ CompareRoot(input, Heap::kNullValueRootIndex);
4411 __ b(eq, true_label); 4413 __ b(eq, true_label);
4412 __ CompareObjectType(input, input, scratch, FIRST_JS_OBJECT_TYPE); 4414 __ CompareObjectType(input, input, scratch,
4413 __ b(lo, false_label); 4415 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE);
4414 __ CompareInstanceType(input, scratch, FIRST_FUNCTION_CLASS_TYPE); 4416 __ b(lt, false_label);
4415 __ b(hs, false_label); 4417 __ CompareInstanceType(input, scratch, LAST_NONCALLABLE_SPEC_OBJECT_TYPE);
4418 __ b(gt, false_label);
4416 // Check for undetectable objects => false. 4419 // Check for undetectable objects => false.
4417 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); 4420 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset));
4418 __ tst(ip, Operand(1 << Map::kIsUndetectable)); 4421 __ tst(ip, Operand(1 << Map::kIsUndetectable));
4419 final_branch_condition = eq; 4422 final_branch_condition = eq;
4420 4423
4421 } else { 4424 } else {
4422 final_branch_condition = ne; 4425 final_branch_condition = ne;
4423 __ b(false_label); 4426 __ b(false_label);
4424 // A dead branch instruction will be generated after this point. 4427 // A dead branch instruction will be generated after this point.
4425 } 4428 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
4549 ASSERT(osr_pc_offset_ == -1); 4552 ASSERT(osr_pc_offset_ == -1);
4550 osr_pc_offset_ = masm()->pc_offset(); 4553 osr_pc_offset_ = masm()->pc_offset();
4551 } 4554 }
4552 4555
4553 4556
4554 4557
4555 4558
4556 #undef __ 4559 #undef __
4557 4560
4558 } } // namespace v8::internal 4561 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/ic-arm.cc ('k') | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698