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

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: Created 9 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
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 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 1752
1753 // Load map. 1753 // Load map.
1754 __ ldr(temp1, FieldMemOperand(input, HeapObject::kMapOffset)); 1754 __ ldr(temp1, FieldMemOperand(input, HeapObject::kMapOffset));
1755 // Undetectable objects behave like undefined. 1755 // Undetectable objects behave like undefined.
1756 __ ldrb(temp2, FieldMemOperand(temp1, Map::kBitFieldOffset)); 1756 __ ldrb(temp2, FieldMemOperand(temp1, Map::kBitFieldOffset));
1757 __ tst(temp2, Operand(1 << Map::kIsUndetectable)); 1757 __ tst(temp2, Operand(1 << Map::kIsUndetectable));
1758 __ b(ne, is_not_object); 1758 __ b(ne, is_not_object);
1759 1759
1760 // Load instance type and check that it is in object type range. 1760 // Load instance type and check that it is in object type range.
1761 __ ldrb(temp2, FieldMemOperand(temp1, Map::kInstanceTypeOffset)); 1761 __ ldrb(temp2, FieldMemOperand(temp1, Map::kInstanceTypeOffset));
1762 __ cmp(temp2, Operand(FIRST_JS_OBJECT_TYPE)); 1762 __ cmp(temp2, Operand(FIRST_OBJECT_CLASS_TYPE));
1763 __ b(lt, is_not_object); 1763 __ b(lt, is_not_object);
1764 __ cmp(temp2, Operand(LAST_JS_OBJECT_TYPE)); 1764 __ cmp(temp2, Operand(LAST_OBJECT_CLASS_TYPE));
1765 return le; 1765 return le;
1766 } 1766 }
1767 1767
1768 1768
1769 void LCodeGen::DoIsObject(LIsObject* instr) { 1769 void LCodeGen::DoIsObject(LIsObject* instr) {
1770 Register reg = ToRegister(instr->InputAt(0)); 1770 Register reg = ToRegister(instr->InputAt(0));
1771 Register result = ToRegister(instr->result()); 1771 Register result = ToRegister(instr->result());
1772 Register temp = scratch0(); 1772 Register temp = scratch0();
1773 Label is_false, is_true, done; 1773 Label is_false, is_true, done;
1774 1774
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1961 void LCodeGen::EmitClassOfTest(Label* is_true, 1961 void LCodeGen::EmitClassOfTest(Label* is_true,
1962 Label* is_false, 1962 Label* is_false,
1963 Handle<String>class_name, 1963 Handle<String>class_name,
1964 Register input, 1964 Register input,
1965 Register temp, 1965 Register temp,
1966 Register temp2) { 1966 Register temp2) {
1967 ASSERT(!input.is(temp)); 1967 ASSERT(!input.is(temp));
1968 ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register. 1968 ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register.
1969 __ tst(input, Operand(kSmiTagMask)); 1969 __ tst(input, Operand(kSmiTagMask));
1970 __ b(eq, is_false); 1970 __ b(eq, is_false);
1971 __ CompareObjectType(input, temp, temp2, FIRST_JS_OBJECT_TYPE); 1971 __ CompareObjectType(input, temp, temp2, FIRST_OBJECT_OR_FUNCTION_CLASS_TYPE);
1972 __ b(lt, is_false); 1972 __ b(lt, is_false);
1973 1973
1974 // Map is now in temp. 1974 // Map is now in temp.
1975 // Functions have class 'Function'. 1975 // Functions have class 'Function'.
1976 __ CompareInstanceType(temp, temp2, JS_FUNCTION_TYPE); 1976 __ CompareInstanceType(temp, temp2, FIRST_FUNCTION_CLASS_TYPE);
1977 if (class_name->IsEqualTo(CStrVector("Function"))) { 1977 if (class_name->IsEqualTo(CStrVector("Function"))) {
1978 __ b(eq, is_true); 1978 __ b(ge, is_true);
1979 } else { 1979 } else {
1980 __ b(eq, is_false); 1980 __ b(ge, is_false);
1981 } 1981 }
1982 1982
1983 // Check if the constructor in the map is a function. 1983 // Check if the constructor in the map is a function.
1984 __ ldr(temp, FieldMemOperand(temp, Map::kConstructorOffset)); 1984 __ ldr(temp, FieldMemOperand(temp, Map::kConstructorOffset));
1985 1985
1986 // As long as JS_FUNCTION_TYPE is the last instance type and it is 1986 // As long as LAST_FUNCTION_CLASS_TYPE is the last instance type and
1987 // right after LAST_JS_OBJECT_TYPE, we can avoid checking for 1987 // FIRST_FUNCITON_CLASS_TYPE comes right after LAST_OBJECT_CLASS_TYPE,
1988 // LAST_JS_OBJECT_TYPE. 1988 // we can avoid checking for LAST_OBJECT_CLASS_TYPE.
1989 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); 1989 ASSERT(LAST_TYPE == LAST_FUNCTION_CLASS_TYPE);
Kevin Millikin (Chromium) 2011/05/26 09:31:08 Do you think that all these asserts can be STATIC_
rossberg 2011/05/31 14:50:24 Done (here and elsewhere).
1990 ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); 1990 ASSERT(FIRST_FUNCTION_CLASS_TYPE == LAST_OBJECT_CLASS_TYPE + 1);
1991 1991
1992 // Objects with a non-function constructor have class 'Object'. 1992 // Objects with a non-function constructor have class 'Object'.
1993 __ CompareObjectType(temp, temp2, temp2, JS_FUNCTION_TYPE); 1993 __ CompareObjectType(temp, temp2, temp2, JS_FUNCTION_TYPE);
1994 if (class_name->IsEqualTo(CStrVector("Object"))) { 1994 if (class_name->IsEqualTo(CStrVector("Object"))) {
1995 __ b(ne, is_true); 1995 __ b(ne, is_true);
1996 } else { 1996 } else {
1997 __ b(ne, is_false); 1997 __ b(ne, is_false);
1998 } 1998 }
1999 1999
2000 // temp now contains the constructor function. Grab the 2000 // temp now contains the constructor function. Grab the
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
2699 __ LoadRoot(scratch, Heap::kNullValueRootIndex); 2699 __ LoadRoot(scratch, Heap::kNullValueRootIndex);
2700 __ cmp(receiver, scratch); 2700 __ cmp(receiver, scratch);
2701 __ b(eq, &global_object); 2701 __ b(eq, &global_object);
2702 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); 2702 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
2703 __ cmp(receiver, scratch); 2703 __ cmp(receiver, scratch);
2704 __ b(eq, &global_object); 2704 __ b(eq, &global_object);
2705 2705
2706 // Deoptimize if the receiver is not a JS object. 2706 // Deoptimize if the receiver is not a JS object.
2707 __ tst(receiver, Operand(kSmiTagMask)); 2707 __ tst(receiver, Operand(kSmiTagMask));
2708 DeoptimizeIf(eq, instr->environment()); 2708 DeoptimizeIf(eq, instr->environment());
2709 __ CompareObjectType(receiver, scratch, scratch, FIRST_JS_OBJECT_TYPE); 2709 __ CompareObjectType(receiver, scratch, scratch,
2710 FIRST_OBJECT_OR_FUNCTION_CLASS_TYPE);
2710 DeoptimizeIf(lo, instr->environment()); 2711 DeoptimizeIf(lo, instr->environment());
2711 __ jmp(&receiver_ok); 2712 __ jmp(&receiver_ok);
2712 2713
2713 __ bind(&global_object); 2714 __ bind(&global_object);
2714 __ ldr(receiver, GlobalObjectOperand()); 2715 __ ldr(receiver, GlobalObjectOperand());
2715 __ bind(&receiver_ok); 2716 __ bind(&receiver_ok);
2716 2717
2717 // Copy the arguments to this function possibly from the 2718 // Copy the arguments to this function possibly from the
2718 // adaptor frame below it. 2719 // adaptor frame below it.
2719 const uint32_t kArgumentsLimit = 1 * KB; 2720 const uint32_t kArgumentsLimit = 1 * KB;
(...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after
4349 4350
4350 } else if (type_name->Equals(heap()->function_symbol())) { 4351 } else if (type_name->Equals(heap()->function_symbol())) {
4351 __ JumpIfSmi(input, false_label); 4352 __ JumpIfSmi(input, false_label);
4352 __ CompareObjectType(input, input, scratch, FIRST_FUNCTION_CLASS_TYPE); 4353 __ CompareObjectType(input, input, scratch, FIRST_FUNCTION_CLASS_TYPE);
4353 final_branch_condition = ge; 4354 final_branch_condition = ge;
4354 4355
4355 } else if (type_name->Equals(heap()->object_symbol())) { 4356 } else if (type_name->Equals(heap()->object_symbol())) {
4356 __ JumpIfSmi(input, false_label); 4357 __ JumpIfSmi(input, false_label);
4357 __ CompareRoot(input, Heap::kNullValueRootIndex); 4358 __ CompareRoot(input, Heap::kNullValueRootIndex);
4358 __ b(eq, true_label); 4359 __ b(eq, true_label);
4359 __ CompareObjectType(input, input, scratch, FIRST_JS_OBJECT_TYPE); 4360 __ CompareObjectType(input, input, scratch, FIRST_OBJECT_CLASS_TYPE);
4360 __ b(lo, false_label); 4361 __ b(lo, false_label);
4361 __ CompareInstanceType(input, scratch, FIRST_FUNCTION_CLASS_TYPE); 4362 __ CompareInstanceType(input, scratch, LAST_OBJECT_CLASS_TYPE);
4362 __ b(hs, false_label); 4363 __ b(hi, false_label);
4363 // Check for undetectable objects => false. 4364 // Check for undetectable objects => false.
4364 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); 4365 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset));
4365 __ tst(ip, Operand(1 << Map::kIsUndetectable)); 4366 __ tst(ip, Operand(1 << Map::kIsUndetectable));
4366 final_branch_condition = eq; 4367 final_branch_condition = eq;
4367 4368
4368 } else { 4369 } else {
4369 final_branch_condition = ne; 4370 final_branch_condition = ne;
4370 __ b(false_label); 4371 __ b(false_label);
4371 // A dead branch instruction will be generated after this point. 4372 // A dead branch instruction will be generated after this point.
4372 } 4373 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
4496 ASSERT(osr_pc_offset_ == -1); 4497 ASSERT(osr_pc_offset_ == -1);
4497 osr_pc_offset_ = masm()->pc_offset(); 4498 osr_pc_offset_ = masm()->pc_offset();
4498 } 4499 }
4499 4500
4500 4501
4501 4502
4502 4503
4503 #undef __ 4504 #undef __
4504 4505
4505 } } // namespace v8::internal 4506 } } // namespace v8::internal
OLDNEW
« src/arm/builtins-arm.cc ('K') | « 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