| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2283 __ j(not_equal, is_true); | 2283 __ j(not_equal, is_true); |
| 2284 } else { | 2284 } else { |
| 2285 __ j(not_equal, is_false); | 2285 __ j(not_equal, is_false); |
| 2286 } | 2286 } |
| 2287 | 2287 |
| 2288 // temp now contains the constructor function. Grab the | 2288 // temp now contains the constructor function. Grab the |
| 2289 // instance class name from there. | 2289 // instance class name from there. |
| 2290 __ movq(temp, FieldOperand(temp, JSFunction::kSharedFunctionInfoOffset)); | 2290 __ movq(temp, FieldOperand(temp, JSFunction::kSharedFunctionInfoOffset)); |
| 2291 __ movq(temp, FieldOperand(temp, | 2291 __ movq(temp, FieldOperand(temp, |
| 2292 SharedFunctionInfo::kInstanceClassNameOffset)); | 2292 SharedFunctionInfo::kInstanceClassNameOffset)); |
| 2293 // The class name we are testing against is a symbol because it's a literal. | 2293 // The class name we are testing against is internalized since it's a literal. |
| 2294 // The name in the constructor is a symbol because of the way the context is | 2294 // The name in the constructor is internalized because of the way the context |
| 2295 // booted. This routine isn't expected to work for random API-created | 2295 // is booted. This routine isn't expected to work for random API-created |
| 2296 // classes and it doesn't have to because you can't access it with natives | 2296 // classes and it doesn't have to because you can't access it with natives |
| 2297 // syntax. Since both sides are symbols it is sufficient to use an identity | 2297 // syntax. Since both sides are internalized it is sufficient to use an |
| 2298 // comparison. | 2298 // identity comparison. |
| 2299 ASSERT(class_name->IsSymbol()); | 2299 ASSERT(class_name->IsInternalizedString()); |
| 2300 __ Cmp(temp, class_name); | 2300 __ Cmp(temp, class_name); |
| 2301 // End with the answer in the z flag. | 2301 // End with the answer in the z flag. |
| 2302 } | 2302 } |
| 2303 | 2303 |
| 2304 | 2304 |
| 2305 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) { | 2305 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) { |
| 2306 Register input = ToRegister(instr->value()); | 2306 Register input = ToRegister(instr->value()); |
| 2307 Register temp = ToRegister(instr->temp()); | 2307 Register temp = ToRegister(instr->temp()); |
| 2308 Register temp2 = ToRegister(instr->temp2()); | 2308 Register temp2 = ToRegister(instr->temp2()); |
| 2309 Handle<String> class_name = instr->hydrogen()->class_name(); | 2309 Handle<String> class_name = instr->hydrogen()->class_name(); |
| (...skipping 3106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5416 EmitBranch(true_block, false_block, final_branch_condition); | 5416 EmitBranch(true_block, false_block, final_branch_condition); |
| 5417 } | 5417 } |
| 5418 } | 5418 } |
| 5419 | 5419 |
| 5420 | 5420 |
| 5421 Condition LCodeGen::EmitTypeofIs(Label* true_label, | 5421 Condition LCodeGen::EmitTypeofIs(Label* true_label, |
| 5422 Label* false_label, | 5422 Label* false_label, |
| 5423 Register input, | 5423 Register input, |
| 5424 Handle<String> type_name) { | 5424 Handle<String> type_name) { |
| 5425 Condition final_branch_condition = no_condition; | 5425 Condition final_branch_condition = no_condition; |
| 5426 if (type_name->Equals(heap()->number_symbol())) { | 5426 if (type_name->Equals(heap()->number_string())) { |
| 5427 __ JumpIfSmi(input, true_label); | 5427 __ JumpIfSmi(input, true_label); |
| 5428 __ CompareRoot(FieldOperand(input, HeapObject::kMapOffset), | 5428 __ CompareRoot(FieldOperand(input, HeapObject::kMapOffset), |
| 5429 Heap::kHeapNumberMapRootIndex); | 5429 Heap::kHeapNumberMapRootIndex); |
| 5430 | 5430 |
| 5431 final_branch_condition = equal; | 5431 final_branch_condition = equal; |
| 5432 | 5432 |
| 5433 } else if (type_name->Equals(heap()->string_symbol())) { | 5433 } else if (type_name->Equals(heap()->string_string())) { |
| 5434 __ JumpIfSmi(input, false_label); | 5434 __ JumpIfSmi(input, false_label); |
| 5435 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input); | 5435 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input); |
| 5436 __ j(above_equal, false_label); | 5436 __ j(above_equal, false_label); |
| 5437 __ testb(FieldOperand(input, Map::kBitFieldOffset), | 5437 __ testb(FieldOperand(input, Map::kBitFieldOffset), |
| 5438 Immediate(1 << Map::kIsUndetectable)); | 5438 Immediate(1 << Map::kIsUndetectable)); |
| 5439 final_branch_condition = zero; | 5439 final_branch_condition = zero; |
| 5440 | 5440 |
| 5441 } else if (type_name->Equals(heap()->boolean_symbol())) { | 5441 } else if (type_name->Equals(heap()->boolean_string())) { |
| 5442 __ CompareRoot(input, Heap::kTrueValueRootIndex); | 5442 __ CompareRoot(input, Heap::kTrueValueRootIndex); |
| 5443 __ j(equal, true_label); | 5443 __ j(equal, true_label); |
| 5444 __ CompareRoot(input, Heap::kFalseValueRootIndex); | 5444 __ CompareRoot(input, Heap::kFalseValueRootIndex); |
| 5445 final_branch_condition = equal; | 5445 final_branch_condition = equal; |
| 5446 | 5446 |
| 5447 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_symbol())) { | 5447 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { |
| 5448 __ CompareRoot(input, Heap::kNullValueRootIndex); | 5448 __ CompareRoot(input, Heap::kNullValueRootIndex); |
| 5449 final_branch_condition = equal; | 5449 final_branch_condition = equal; |
| 5450 | 5450 |
| 5451 } else if (type_name->Equals(heap()->undefined_symbol())) { | 5451 } else if (type_name->Equals(heap()->undefined_string())) { |
| 5452 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); | 5452 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); |
| 5453 __ j(equal, true_label); | 5453 __ j(equal, true_label); |
| 5454 __ JumpIfSmi(input, false_label); | 5454 __ JumpIfSmi(input, false_label); |
| 5455 // Check for undetectable objects => true. | 5455 // Check for undetectable objects => true. |
| 5456 __ movq(input, FieldOperand(input, HeapObject::kMapOffset)); | 5456 __ movq(input, FieldOperand(input, HeapObject::kMapOffset)); |
| 5457 __ testb(FieldOperand(input, Map::kBitFieldOffset), | 5457 __ testb(FieldOperand(input, Map::kBitFieldOffset), |
| 5458 Immediate(1 << Map::kIsUndetectable)); | 5458 Immediate(1 << Map::kIsUndetectable)); |
| 5459 final_branch_condition = not_zero; | 5459 final_branch_condition = not_zero; |
| 5460 | 5460 |
| 5461 } else if (type_name->Equals(heap()->function_symbol())) { | 5461 } else if (type_name->Equals(heap()->function_string())) { |
| 5462 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 5462 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
| 5463 __ JumpIfSmi(input, false_label); | 5463 __ JumpIfSmi(input, false_label); |
| 5464 __ CmpObjectType(input, JS_FUNCTION_TYPE, input); | 5464 __ CmpObjectType(input, JS_FUNCTION_TYPE, input); |
| 5465 __ j(equal, true_label); | 5465 __ j(equal, true_label); |
| 5466 __ CmpInstanceType(input, JS_FUNCTION_PROXY_TYPE); | 5466 __ CmpInstanceType(input, JS_FUNCTION_PROXY_TYPE); |
| 5467 final_branch_condition = equal; | 5467 final_branch_condition = equal; |
| 5468 | 5468 |
| 5469 } else if (type_name->Equals(heap()->object_symbol())) { | 5469 } else if (type_name->Equals(heap()->object_string())) { |
| 5470 __ JumpIfSmi(input, false_label); | 5470 __ JumpIfSmi(input, false_label); |
| 5471 if (!FLAG_harmony_typeof) { | 5471 if (!FLAG_harmony_typeof) { |
| 5472 __ CompareRoot(input, Heap::kNullValueRootIndex); | 5472 __ CompareRoot(input, Heap::kNullValueRootIndex); |
| 5473 __ j(equal, true_label); | 5473 __ j(equal, true_label); |
| 5474 } | 5474 } |
| 5475 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); | 5475 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); |
| 5476 __ j(below, false_label); | 5476 __ j(below, false_label); |
| 5477 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 5477 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
| 5478 __ j(above, false_label); | 5478 __ j(above, false_label); |
| 5479 // Check for undetectable objects => false. | 5479 // Check for undetectable objects => false. |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5742 FixedArray::kHeaderSize - kPointerSize)); | 5742 FixedArray::kHeaderSize - kPointerSize)); |
| 5743 __ bind(&done); | 5743 __ bind(&done); |
| 5744 } | 5744 } |
| 5745 | 5745 |
| 5746 | 5746 |
| 5747 #undef __ | 5747 #undef __ |
| 5748 | 5748 |
| 5749 } } // namespace v8::internal | 5749 } } // namespace v8::internal |
| 5750 | 5750 |
| 5751 #endif // V8_TARGET_ARCH_X64 | 5751 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |