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 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 911 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 911 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 912 __ Branch(&exit, eq, a0, Operand(at)); | 912 __ Branch(&exit, eq, a0, Operand(at)); |
| 913 Register null_value = t1; | 913 Register null_value = t1; |
| 914 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | 914 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
| 915 __ Branch(&exit, eq, a0, Operand(null_value)); | 915 __ Branch(&exit, eq, a0, Operand(null_value)); |
| 916 | 916 |
| 917 // Convert the object to a JS object. | 917 // Convert the object to a JS object. |
| 918 Label convert, done_convert; | 918 Label convert, done_convert; |
| 919 __ JumpIfSmi(a0, &convert); | 919 __ JumpIfSmi(a0, &convert); |
| 920 __ GetObjectType(a0, a1, a1); | 920 __ GetObjectType(a0, a1, a1); |
| 921 __ Branch(&done_convert, hs, a1, Operand(FIRST_JS_OBJECT_TYPE)); | 921 __ Branch(&done_convert, ge, a1, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 922 __ bind(&convert); | 922 __ bind(&convert); |
| 923 __ push(a0); | 923 __ push(a0); |
| 924 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 924 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 925 __ mov(a0, v0); | 925 __ mov(a0, v0); |
| 926 __ bind(&done_convert); | 926 __ bind(&done_convert); |
| 927 __ push(a0); | 927 __ push(a0); |
| 928 | 928 |
| 929 // Check cache validity in generated code. This is a fast case for | 929 // Check cache validity in generated code. This is a fast case for |
| 930 // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 930 // the JSObject::IsSimpleEnum cache validity checks. If we cannot |
| 931 // guarantee cache validity, call the runtime system to check cache | 931 // guarantee cache validity, call the runtime system to check cache |
| (...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2470 | 2470 |
| 2471 __ JumpIfSmi(v0, if_false); | 2471 __ JumpIfSmi(v0, if_false); |
| 2472 __ LoadRoot(at, Heap::kNullValueRootIndex); | 2472 __ LoadRoot(at, Heap::kNullValueRootIndex); |
| 2473 __ Branch(if_true, eq, v0, Operand(at)); | 2473 __ Branch(if_true, eq, v0, Operand(at)); |
| 2474 __ lw(a2, FieldMemOperand(v0, HeapObject::kMapOffset)); | 2474 __ lw(a2, FieldMemOperand(v0, HeapObject::kMapOffset)); |
| 2475 // Undetectable objects behave like undefined when tested with typeof. | 2475 // Undetectable objects behave like undefined when tested with typeof. |
| 2476 __ lbu(a1, FieldMemOperand(a2, Map::kBitFieldOffset)); | 2476 __ lbu(a1, FieldMemOperand(a2, Map::kBitFieldOffset)); |
| 2477 __ And(at, a1, Operand(1 << Map::kIsUndetectable)); | 2477 __ And(at, a1, Operand(1 << Map::kIsUndetectable)); |
| 2478 __ Branch(if_false, ne, at, Operand(zero_reg)); | 2478 __ Branch(if_false, ne, at, Operand(zero_reg)); |
| 2479 __ lbu(a1, FieldMemOperand(a2, Map::kInstanceTypeOffset)); | 2479 __ lbu(a1, FieldMemOperand(a2, Map::kInstanceTypeOffset)); |
| 2480 __ Branch(if_false, lt, a1, Operand(FIRST_JS_OBJECT_TYPE)); | 2480 __ Branch(if_false, lt, a1, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
| 2481 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 2481 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
| 2482 Split(le, a1, Operand(LAST_JS_OBJECT_TYPE), if_true, if_false, fall_through); | 2482 Split(le, a1, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE), if_true, if_false, f all_through); |
|
Mads Ager (chromium)
2011/06/06 08:44:20
Line too long.
| |
| 2483 | 2483 |
| 2484 context()->Plug(if_true, if_false); | 2484 context()->Plug(if_true, if_false); |
| 2485 } | 2485 } |
| 2486 | 2486 |
| 2487 | 2487 |
| 2488 void FullCodeGenerator::EmitIsSpecObject(ZoneList<Expression*>* args) { | 2488 void FullCodeGenerator::EmitIsSpecObject(ZoneList<Expression*>* args) { |
| 2489 ASSERT(args->length() == 1); | 2489 ASSERT(args->length() == 1); |
| 2490 | 2490 |
| 2491 VisitForAccumulatorValue(args->at(0)); | 2491 VisitForAccumulatorValue(args->at(0)); |
| 2492 | 2492 |
| 2493 Label materialize_true, materialize_false; | 2493 Label materialize_true, materialize_false; |
| 2494 Label* if_true = NULL; | 2494 Label* if_true = NULL; |
| 2495 Label* if_false = NULL; | 2495 Label* if_false = NULL; |
| 2496 Label* fall_through = NULL; | 2496 Label* fall_through = NULL; |
| 2497 context()->PrepareTest(&materialize_true, &materialize_false, | 2497 context()->PrepareTest(&materialize_true, &materialize_false, |
| 2498 &if_true, &if_false, &fall_through); | 2498 &if_true, &if_false, &fall_through); |
| 2499 | 2499 |
| 2500 __ JumpIfSmi(v0, if_false); | 2500 __ JumpIfSmi(v0, if_false); |
| 2501 __ GetObjectType(v0, a1, a1); | 2501 __ GetObjectType(v0, a1, a1); |
| 2502 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 2502 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
| 2503 Split(ge, a1, Operand(FIRST_JS_OBJECT_TYPE), | 2503 Split(ge, a1, Operand(FIRST_SPEC_OBJECT_TYPE), |
| 2504 if_true, if_false, fall_through); | 2504 if_true, if_false, fall_through); |
| 2505 | 2505 |
| 2506 context()->Plug(if_true, if_false); | 2506 context()->Plug(if_true, if_false); |
| 2507 } | 2507 } |
| 2508 | 2508 |
| 2509 | 2509 |
| 2510 void FullCodeGenerator::EmitIsUndetectableObject(ZoneList<Expression*>* args) { | 2510 void FullCodeGenerator::EmitIsUndetectableObject(ZoneList<Expression*>* args) { |
| 2511 ASSERT(args->length() == 1); | 2511 ASSERT(args->length() == 1); |
| 2512 | 2512 |
| 2513 VisitForAccumulatorValue(args->at(0)); | 2513 VisitForAccumulatorValue(args->at(0)); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2772 Label done, null, function, non_function_constructor; | 2772 Label done, null, function, non_function_constructor; |
| 2773 | 2773 |
| 2774 VisitForAccumulatorValue(args->at(0)); | 2774 VisitForAccumulatorValue(args->at(0)); |
| 2775 | 2775 |
| 2776 // If the object is a smi, we return null. | 2776 // If the object is a smi, we return null. |
| 2777 __ JumpIfSmi(v0, &null); | 2777 __ JumpIfSmi(v0, &null); |
| 2778 | 2778 |
| 2779 // Check that the object is a JS object but take special care of JS | 2779 // Check that the object is a JS object but take special care of JS |
| 2780 // functions to make sure they have 'Function' as their class. | 2780 // functions to make sure they have 'Function' as their class. |
| 2781 __ GetObjectType(v0, v0, a1); // Map is now in v0. | 2781 __ GetObjectType(v0, v0, a1); // Map is now in v0. |
| 2782 __ Branch(&null, lt, a1, Operand(FIRST_JS_OBJECT_TYPE)); | 2782 __ Branch(&null, lt, a1, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 2783 | 2783 |
| 2784 // As long as JS_FUNCTION_TYPE is the last instance type and it is | 2784 // As long as LAST_CALLABLE_SPEC_OBJECT_TYPE is the last instance type, and |
| 2785 // right after LAST_JS_OBJECT_TYPE, we can avoid checking for | 2785 // FIRST_CALLABLE_SPEC_OBJECT_TYPE comes right after |
| 2786 // LAST_JS_OBJECT_TYPE. | 2786 // LAST_NONCALLABLE_SPEC_OBJECT_TYPE, we can avoid checking for the latter. |
| 2787 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 2787 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE); |
| 2788 ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); | 2788 STATIC_ASSERT(FIRST_CALLABLE_SPEC_OBJECT_TYPE == |
| 2789 __ Branch(&function, eq, a1, Operand(JS_FUNCTION_TYPE)); | 2789 LAST_NONCALLABLE_SPEC_OBJECT_TYPE + 1); |
| 2790 __ Branch(&function, ge, a1, Operand(FIRST_CALLABLE_SPEC_OBJECT_TYPE)); | |
| 2790 | 2791 |
| 2791 // Check if the constructor in the map is a function. | 2792 // Check if the constructor in the map is a function. |
| 2792 __ lw(v0, FieldMemOperand(v0, Map::kConstructorOffset)); | 2793 __ lw(v0, FieldMemOperand(v0, Map::kConstructorOffset)); |
| 2793 __ GetObjectType(v0, a1, a1); | 2794 __ GetObjectType(v0, a1, a1); |
| 2794 __ Branch(&non_function_constructor, ne, a1, Operand(JS_FUNCTION_TYPE)); | 2795 __ Branch(&non_function_constructor, ne, a1, Operand(JS_FUNCTION_TYPE)); |
| 2795 | 2796 |
| 2796 // v0 now contains the constructor function. Grab the | 2797 // v0 now contains the constructor function. Grab the |
| 2797 // instance class name from there. | 2798 // instance class name from there. |
| 2798 __ lw(v0, FieldMemOperand(v0, JSFunction::kSharedFunctionInfoOffset)); | 2799 __ lw(v0, FieldMemOperand(v0, JSFunction::kSharedFunctionInfoOffset)); |
| 2799 __ lw(v0, FieldMemOperand(v0, SharedFunctionInfo::kInstanceClassNameOffset)); | 2800 __ lw(v0, FieldMemOperand(v0, SharedFunctionInfo::kInstanceClassNameOffset)); |
| (...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4091 __ Branch(if_true, eq, v0, Operand(at)); | 4092 __ Branch(if_true, eq, v0, Operand(at)); |
| 4092 __ JumpIfSmi(v0, if_false); | 4093 __ JumpIfSmi(v0, if_false); |
| 4093 // Check for undetectable objects => true. | 4094 // Check for undetectable objects => true. |
| 4094 __ lw(v0, FieldMemOperand(v0, HeapObject::kMapOffset)); | 4095 __ lw(v0, FieldMemOperand(v0, HeapObject::kMapOffset)); |
| 4095 __ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset)); | 4096 __ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset)); |
| 4096 __ And(a1, a1, Operand(1 << Map::kIsUndetectable)); | 4097 __ And(a1, a1, Operand(1 << Map::kIsUndetectable)); |
| 4097 Split(ne, a1, Operand(zero_reg), if_true, if_false, fall_through); | 4098 Split(ne, a1, Operand(zero_reg), if_true, if_false, fall_through); |
| 4098 } else if (check->Equals(isolate()->heap()->function_symbol())) { | 4099 } else if (check->Equals(isolate()->heap()->function_symbol())) { |
| 4099 __ JumpIfSmi(v0, if_false); | 4100 __ JumpIfSmi(v0, if_false); |
| 4100 __ GetObjectType(v0, a1, v0); // Leave map in a1. | 4101 __ GetObjectType(v0, a1, v0); // Leave map in a1. |
| 4101 Split(ge, v0, Operand(FIRST_FUNCTION_CLASS_TYPE), | 4102 Split(ge, v0, Operand(FIRST_CALLABLE_SPEC_OBJECT_TYPE), |
| 4102 if_true, if_false, fall_through); | 4103 if_true, if_false, fall_through); |
| 4103 | 4104 |
| 4104 } else if (check->Equals(isolate()->heap()->object_symbol())) { | 4105 } else if (check->Equals(isolate()->heap()->object_symbol())) { |
| 4105 __ JumpIfSmi(v0, if_false); | 4106 __ JumpIfSmi(v0, if_false); |
| 4106 __ LoadRoot(at, Heap::kNullValueRootIndex); | 4107 __ LoadRoot(at, Heap::kNullValueRootIndex); |
| 4107 __ Branch(if_true, eq, v0, Operand(at)); | 4108 __ Branch(if_true, eq, v0, Operand(at)); |
| 4108 // Check for JS objects => true. | 4109 // Check for JS objects => true. |
| 4109 __ GetObjectType(v0, v0, a1); | 4110 __ GetObjectType(v0, v0, a1); |
| 4110 __ Branch(if_false, lo, a1, Operand(FIRST_JS_OBJECT_TYPE)); | 4111 __ Branch(if_false, lt, a1, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
| 4111 __ lbu(a1, FieldMemOperand(v0, Map::kInstanceTypeOffset)); | 4112 __ lbu(a1, FieldMemOperand(v0, Map::kInstanceTypeOffset)); |
| 4112 __ Branch(if_false, hs, a1, Operand(FIRST_FUNCTION_CLASS_TYPE)); | 4113 __ Branch(if_false, gt, a1, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
| 4113 // Check for undetectable objects => false. | 4114 // Check for undetectable objects => false. |
| 4114 __ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset)); | 4115 __ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset)); |
| 4115 __ And(a1, a1, Operand(1 << Map::kIsUndetectable)); | 4116 __ And(a1, a1, Operand(1 << Map::kIsUndetectable)); |
| 4116 Split(eq, a1, Operand(zero_reg), if_true, if_false, fall_through); | 4117 Split(eq, a1, Operand(zero_reg), if_true, if_false, fall_through); |
| 4117 } else { | 4118 } else { |
| 4118 if (if_false != fall_through) __ jmp(if_false); | 4119 if (if_false != fall_through) __ jmp(if_false); |
| 4119 } | 4120 } |
| 4120 | 4121 |
| 4121 return true; | 4122 return true; |
| 4122 } | 4123 } |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4380 __ Addu(at, a1, Operand(masm_->CodeObject())); | 4381 __ Addu(at, a1, Operand(masm_->CodeObject())); |
| 4381 __ Jump(at); | 4382 __ Jump(at); |
| 4382 } | 4383 } |
| 4383 | 4384 |
| 4384 | 4385 |
| 4385 #undef __ | 4386 #undef __ |
| 4386 | 4387 |
| 4387 } } // namespace v8::internal | 4388 } } // namespace v8::internal |
| 4388 | 4389 |
| 4389 #endif // V8_TARGET_ARCH_MIPS | 4390 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |