Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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_NONCALLABLE_SPEC_OBJECT_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_NONCALLABLE_SPEC_OBJECT_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 Loading... | |
| 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_SPEC_OBJECT_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_CALLABLE_SPEC_OBJECT_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_CALLABLE_SPEC_OBJECT_TYPE is the last instance type and |
| 1987 // right after LAST_JS_OBJECT_TYPE, we can avoid checking for | 1987 // FIRST_CALLABLE_SPEC_OBJECT_TYPE comes right after |
| 1988 // LAST_JS_OBJECT_TYPE. | 1988 // LAST_NONCALLABLE_SPEC_OBJECT_TYPE, we can avoid checking for the latter. |
| 1989 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 1989 ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE); |
| 1990 ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); | 1990 ASSERT(FIRST_CALLABLE_SPEC_OBJECT_TYPE == |
| 1991 LAST_NONCALLABLE_SPEC_OBJECT_TYPE + 1); | |
| 1991 | 1992 |
| 1992 // Objects with a non-function constructor have class 'Object'. | 1993 // Objects with a non-function constructor have class 'Object'. |
| 1993 __ CompareObjectType(temp, temp2, temp2, JS_FUNCTION_TYPE); | 1994 __ CompareObjectType(temp, temp2, temp2, JS_FUNCTION_TYPE); |
| 1994 if (class_name->IsEqualTo(CStrVector("Object"))) { | 1995 if (class_name->IsEqualTo(CStrVector("Object"))) { |
| 1995 __ b(ne, is_true); | 1996 __ b(ne, is_true); |
| 1996 } else { | 1997 } else { |
| 1997 __ b(ne, is_false); | 1998 __ b(ne, is_false); |
| 1998 } | 1999 } |
| 1999 | 2000 |
| 2000 // temp now contains the constructor function. Grab the | 2001 // temp now contains the constructor function. Grab the |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2699 __ LoadRoot(scratch, Heap::kNullValueRootIndex); | 2700 __ LoadRoot(scratch, Heap::kNullValueRootIndex); |
| 2700 __ cmp(receiver, scratch); | 2701 __ cmp(receiver, scratch); |
| 2701 __ b(eq, &global_object); | 2702 __ b(eq, &global_object); |
| 2702 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | 2703 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
| 2703 __ cmp(receiver, scratch); | 2704 __ cmp(receiver, scratch); |
| 2704 __ b(eq, &global_object); | 2705 __ b(eq, &global_object); |
| 2705 | 2706 |
| 2706 // Deoptimize if the receiver is not a JS object. | 2707 // Deoptimize if the receiver is not a JS object. |
| 2707 __ tst(receiver, Operand(kSmiTagMask)); | 2708 __ tst(receiver, Operand(kSmiTagMask)); |
| 2708 DeoptimizeIf(eq, instr->environment()); | 2709 DeoptimizeIf(eq, instr->environment()); |
| 2709 __ CompareObjectType(receiver, scratch, scratch, FIRST_JS_OBJECT_TYPE); | 2710 __ CompareObjectType(receiver, scratch, scratch, FIRST_SPEC_OBJECT_TYPE); |
| 2710 DeoptimizeIf(lo, instr->environment()); | 2711 DeoptimizeIf(lo, instr->environment()); |
|
Kevin Millikin (Chromium)
2011/05/30 16:32:29
"lo" --> "lt"
rossberg
2011/05/31 14:50:24
Done.
| |
| 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; |
| 2720 __ cmp(length, Operand(kArgumentsLimit)); | 2721 __ cmp(length, Operand(kArgumentsLimit)); |
| (...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4342 __ b(eq, true_label); | 4343 __ b(eq, true_label); |
| 4343 __ JumpIfSmi(input, false_label); | 4344 __ JumpIfSmi(input, false_label); |
| 4344 // Check for undetectable objects => true. | 4345 // Check for undetectable objects => true. |
| 4345 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 4346 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); |
| 4346 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 4347 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); |
| 4347 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 4348 __ tst(ip, Operand(1 << Map::kIsUndetectable)); |
| 4348 final_branch_condition = ne; | 4349 final_branch_condition = ne; |
| 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, |
| 4354 FIRST_CALLABLE_SPEC_OBJECT_TYPE); | |
| 4353 final_branch_condition = ge; | 4355 final_branch_condition = ge; |
| 4354 | 4356 |
| 4355 } else if (type_name->Equals(heap()->object_symbol())) { | 4357 } else if (type_name->Equals(heap()->object_symbol())) { |
| 4356 __ JumpIfSmi(input, false_label); | 4358 __ JumpIfSmi(input, false_label); |
| 4357 __ CompareRoot(input, Heap::kNullValueRootIndex); | 4359 __ CompareRoot(input, Heap::kNullValueRootIndex); |
| 4358 __ b(eq, true_label); | 4360 __ b(eq, true_label); |
| 4359 __ CompareObjectType(input, input, scratch, FIRST_JS_OBJECT_TYPE); | 4361 __ CompareObjectType(input, input, scratch, |
| 4362 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); | |
| 4360 __ b(lo, false_label); | 4363 __ b(lo, false_label); |
|
Kevin Millikin (Chromium)
2011/05/30 16:32:29
"lo" --> "lt", "hi" --> "gt" just below.
rossberg
2011/05/31 14:50:24
Done.
| |
| 4361 __ CompareInstanceType(input, scratch, FIRST_FUNCTION_CLASS_TYPE); | 4364 __ CompareInstanceType(input, scratch, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
| 4362 __ b(hs, false_label); | 4365 __ b(hi, false_label); |
| 4363 // Check for undetectable objects => false. | 4366 // Check for undetectable objects => false. |
| 4364 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 4367 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); |
| 4365 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 4368 __ tst(ip, Operand(1 << Map::kIsUndetectable)); |
| 4366 final_branch_condition = eq; | 4369 final_branch_condition = eq; |
| 4367 | 4370 |
| 4368 } else { | 4371 } else { |
| 4369 final_branch_condition = ne; | 4372 final_branch_condition = ne; |
| 4370 __ b(false_label); | 4373 __ b(false_label); |
| 4371 // A dead branch instruction will be generated after this point. | 4374 // A dead branch instruction will be generated after this point. |
| 4372 } | 4375 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4496 ASSERT(osr_pc_offset_ == -1); | 4499 ASSERT(osr_pc_offset_ == -1); |
| 4497 osr_pc_offset_ = masm()->pc_offset(); | 4500 osr_pc_offset_ = masm()->pc_offset(); |
| 4498 } | 4501 } |
| 4499 | 4502 |
| 4500 | 4503 |
| 4501 | 4504 |
| 4502 | 4505 |
| 4503 #undef __ | 4506 #undef __ |
| 4504 | 4507 |
| 4505 } } // namespace v8::internal | 4508 } } // namespace v8::internal |
| OLD | NEW |