OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 4513 matching lines...) Loading... |
4524 Label* if_false = NULL; | 4524 Label* if_false = NULL; |
4525 Label* fall_through = NULL; | 4525 Label* fall_through = NULL; |
4526 context()->PrepareTest(&materialize_true, &materialize_false, | 4526 context()->PrepareTest(&materialize_true, &materialize_false, |
4527 &if_true, &if_false, &fall_through); | 4527 &if_true, &if_false, &fall_through); |
4528 | 4528 |
4529 { AccumulatorValueContext context(this); | 4529 { AccumulatorValueContext context(this); |
4530 VisitForTypeofValue(sub_expr); | 4530 VisitForTypeofValue(sub_expr); |
4531 } | 4531 } |
4532 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 4532 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
4533 | 4533 |
4534 if (check->Equals(isolate()->heap()->number_string())) { | 4534 Factory* factory = isolate()->factory(); |
| 4535 if (String::Equals(check, factory->number_string())) { |
4535 __ JumpIfSmi(rax, if_true); | 4536 __ JumpIfSmi(rax, if_true); |
4536 __ movp(rax, FieldOperand(rax, HeapObject::kMapOffset)); | 4537 __ movp(rax, FieldOperand(rax, HeapObject::kMapOffset)); |
4537 __ CompareRoot(rax, Heap::kHeapNumberMapRootIndex); | 4538 __ CompareRoot(rax, Heap::kHeapNumberMapRootIndex); |
4538 Split(equal, if_true, if_false, fall_through); | 4539 Split(equal, if_true, if_false, fall_through); |
4539 } else if (check->Equals(isolate()->heap()->string_string())) { | 4540 } else if (String::Equals(check, factory->string_string())) { |
4540 __ JumpIfSmi(rax, if_false); | 4541 __ JumpIfSmi(rax, if_false); |
4541 // Check for undetectable objects => false. | 4542 // Check for undetectable objects => false. |
4542 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdx); | 4543 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdx); |
4543 __ j(above_equal, if_false); | 4544 __ j(above_equal, if_false); |
4544 __ testb(FieldOperand(rdx, Map::kBitFieldOffset), | 4545 __ testb(FieldOperand(rdx, Map::kBitFieldOffset), |
4545 Immediate(1 << Map::kIsUndetectable)); | 4546 Immediate(1 << Map::kIsUndetectable)); |
4546 Split(zero, if_true, if_false, fall_through); | 4547 Split(zero, if_true, if_false, fall_through); |
4547 } else if (check->Equals(isolate()->heap()->symbol_string())) { | 4548 } else if (String::Equals(check, factory->symbol_string())) { |
4548 __ JumpIfSmi(rax, if_false); | 4549 __ JumpIfSmi(rax, if_false); |
4549 __ CmpObjectType(rax, SYMBOL_TYPE, rdx); | 4550 __ CmpObjectType(rax, SYMBOL_TYPE, rdx); |
4550 Split(equal, if_true, if_false, fall_through); | 4551 Split(equal, if_true, if_false, fall_through); |
4551 } else if (check->Equals(isolate()->heap()->boolean_string())) { | 4552 } else if (String::Equals(check, factory->boolean_string())) { |
4552 __ CompareRoot(rax, Heap::kTrueValueRootIndex); | 4553 __ CompareRoot(rax, Heap::kTrueValueRootIndex); |
4553 __ j(equal, if_true); | 4554 __ j(equal, if_true); |
4554 __ CompareRoot(rax, Heap::kFalseValueRootIndex); | 4555 __ CompareRoot(rax, Heap::kFalseValueRootIndex); |
4555 Split(equal, if_true, if_false, fall_through); | 4556 Split(equal, if_true, if_false, fall_through); |
4556 } else if (FLAG_harmony_typeof && | 4557 } else if (FLAG_harmony_typeof && |
4557 check->Equals(isolate()->heap()->null_string())) { | 4558 String::Equals(check, factory->null_string())) { |
4558 __ CompareRoot(rax, Heap::kNullValueRootIndex); | 4559 __ CompareRoot(rax, Heap::kNullValueRootIndex); |
4559 Split(equal, if_true, if_false, fall_through); | 4560 Split(equal, if_true, if_false, fall_through); |
4560 } else if (check->Equals(isolate()->heap()->undefined_string())) { | 4561 } else if (String::Equals(check, factory->undefined_string())) { |
4561 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); | 4562 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); |
4562 __ j(equal, if_true); | 4563 __ j(equal, if_true); |
4563 __ JumpIfSmi(rax, if_false); | 4564 __ JumpIfSmi(rax, if_false); |
4564 // Check for undetectable objects => true. | 4565 // Check for undetectable objects => true. |
4565 __ movp(rdx, FieldOperand(rax, HeapObject::kMapOffset)); | 4566 __ movp(rdx, FieldOperand(rax, HeapObject::kMapOffset)); |
4566 __ testb(FieldOperand(rdx, Map::kBitFieldOffset), | 4567 __ testb(FieldOperand(rdx, Map::kBitFieldOffset), |
4567 Immediate(1 << Map::kIsUndetectable)); | 4568 Immediate(1 << Map::kIsUndetectable)); |
4568 Split(not_zero, if_true, if_false, fall_through); | 4569 Split(not_zero, if_true, if_false, fall_through); |
4569 } else if (check->Equals(isolate()->heap()->function_string())) { | 4570 } else if (String::Equals(check, factory->function_string())) { |
4570 __ JumpIfSmi(rax, if_false); | 4571 __ JumpIfSmi(rax, if_false); |
4571 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 4572 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
4572 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rdx); | 4573 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rdx); |
4573 __ j(equal, if_true); | 4574 __ j(equal, if_true); |
4574 __ CmpInstanceType(rdx, JS_FUNCTION_PROXY_TYPE); | 4575 __ CmpInstanceType(rdx, JS_FUNCTION_PROXY_TYPE); |
4575 Split(equal, if_true, if_false, fall_through); | 4576 Split(equal, if_true, if_false, fall_through); |
4576 } else if (check->Equals(isolate()->heap()->object_string())) { | 4577 } else if (String::Equals(check, factory->object_string())) { |
4577 __ JumpIfSmi(rax, if_false); | 4578 __ JumpIfSmi(rax, if_false); |
4578 if (!FLAG_harmony_typeof) { | 4579 if (!FLAG_harmony_typeof) { |
4579 __ CompareRoot(rax, Heap::kNullValueRootIndex); | 4580 __ CompareRoot(rax, Heap::kNullValueRootIndex); |
4580 __ j(equal, if_true); | 4581 __ j(equal, if_true); |
4581 } | 4582 } |
4582 __ CmpObjectType(rax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, rdx); | 4583 __ CmpObjectType(rax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, rdx); |
4583 __ j(below, if_false); | 4584 __ j(below, if_false); |
4584 __ CmpInstanceType(rdx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 4585 __ CmpInstanceType(rdx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
4585 __ j(above, if_false); | 4586 __ j(above, if_false); |
4586 // Check for undetectable objects => false. | 4587 // Check for undetectable objects => false. |
(...skipping 330 matching lines...) Loading... |
4917 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4918 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4918 Assembler::target_address_at(call_target_address, | 4919 Assembler::target_address_at(call_target_address, |
4919 unoptimized_code)); | 4920 unoptimized_code)); |
4920 return OSR_AFTER_STACK_CHECK; | 4921 return OSR_AFTER_STACK_CHECK; |
4921 } | 4922 } |
4922 | 4923 |
4923 | 4924 |
4924 } } // namespace v8::internal | 4925 } } // namespace v8::internal |
4925 | 4926 |
4926 #endif // V8_TARGET_ARCH_X64 | 4927 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |