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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 | 115 |
116 bool LCodeGen::GeneratePrologue() { | 116 bool LCodeGen::GeneratePrologue() { |
117 ASSERT(is_generating()); | 117 ASSERT(is_generating()); |
118 | 118 |
119 if (info()->IsOptimizing()) { | 119 if (info()->IsOptimizing()) { |
120 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 120 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
121 | 121 |
122 #ifdef DEBUG | 122 #ifdef DEBUG |
123 if (strlen(FLAG_stop_at) > 0 && | 123 if (strlen(FLAG_stop_at) > 0 && |
124 info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 124 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
125 __ stop("stop_at"); | 125 __ stop("stop_at"); |
126 } | 126 } |
127 #endif | 127 #endif |
128 | 128 |
129 // r1: Callee's JS function. | 129 // r1: Callee's JS function. |
130 // cp: Callee's context. | 130 // cp: Callee's context. |
131 // fp: Caller's frame pointer. | 131 // fp: Caller's frame pointer. |
132 // lr: Caller's pc. | 132 // lr: Caller's pc. |
133 | 133 |
134 // Strict mode functions and builtins need to replace the receiver | 134 // Strict mode functions and builtins need to replace the receiver |
(...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2554 Handle<String>class_name, | 2554 Handle<String>class_name, |
2555 Register input, | 2555 Register input, |
2556 Register temp, | 2556 Register temp, |
2557 Register temp2) { | 2557 Register temp2) { |
2558 ASSERT(!input.is(temp)); | 2558 ASSERT(!input.is(temp)); |
2559 ASSERT(!input.is(temp2)); | 2559 ASSERT(!input.is(temp2)); |
2560 ASSERT(!temp.is(temp2)); | 2560 ASSERT(!temp.is(temp2)); |
2561 | 2561 |
2562 __ JumpIfSmi(input, is_false); | 2562 __ JumpIfSmi(input, is_false); |
2563 | 2563 |
2564 if (class_name->IsEqualTo(CStrVector("Function"))) { | 2564 if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Function"))) { |
2565 // Assuming the following assertions, we can use the same compares to test | 2565 // Assuming the following assertions, we can use the same compares to test |
2566 // for both being a function type and being in the object type range. | 2566 // for both being a function type and being in the object type range. |
2567 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 2567 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
2568 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2568 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == |
2569 FIRST_SPEC_OBJECT_TYPE + 1); | 2569 FIRST_SPEC_OBJECT_TYPE + 1); |
2570 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2570 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
2571 LAST_SPEC_OBJECT_TYPE - 1); | 2571 LAST_SPEC_OBJECT_TYPE - 1); |
2572 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 2572 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
2573 __ CompareObjectType(input, temp, temp2, FIRST_SPEC_OBJECT_TYPE); | 2573 __ CompareObjectType(input, temp, temp2, FIRST_SPEC_OBJECT_TYPE); |
2574 __ b(lt, is_false); | 2574 __ b(lt, is_false); |
(...skipping 10 matching lines...) Expand all Loading... |
2585 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2585 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
2586 __ b(gt, is_false); | 2586 __ b(gt, is_false); |
2587 } | 2587 } |
2588 | 2588 |
2589 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | 2589 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. |
2590 // Check if the constructor in the map is a function. | 2590 // Check if the constructor in the map is a function. |
2591 __ ldr(temp, FieldMemOperand(temp, Map::kConstructorOffset)); | 2591 __ ldr(temp, FieldMemOperand(temp, Map::kConstructorOffset)); |
2592 | 2592 |
2593 // Objects with a non-function constructor have class 'Object'. | 2593 // Objects with a non-function constructor have class 'Object'. |
2594 __ CompareObjectType(temp, temp2, temp2, JS_FUNCTION_TYPE); | 2594 __ CompareObjectType(temp, temp2, temp2, JS_FUNCTION_TYPE); |
2595 if (class_name->IsEqualTo(CStrVector("Object"))) { | 2595 if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Object"))) { |
2596 __ b(ne, is_true); | 2596 __ b(ne, is_true); |
2597 } else { | 2597 } else { |
2598 __ b(ne, is_false); | 2598 __ b(ne, is_false); |
2599 } | 2599 } |
2600 | 2600 |
2601 // temp now contains the constructor function. Grab the | 2601 // temp now contains the constructor function. Grab the |
2602 // instance class name from there. | 2602 // instance class name from there. |
2603 __ ldr(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); | 2603 __ ldr(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); |
2604 __ ldr(temp, FieldMemOperand(temp, | 2604 __ ldr(temp, FieldMemOperand(temp, |
2605 SharedFunctionInfo::kInstanceClassNameOffset)); | 2605 SharedFunctionInfo::kInstanceClassNameOffset)); |
(...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4616 }; | 4616 }; |
4617 | 4617 |
4618 DeferredStringCharFromCode* deferred = | 4618 DeferredStringCharFromCode* deferred = |
4619 new(zone()) DeferredStringCharFromCode(this, instr); | 4619 new(zone()) DeferredStringCharFromCode(this, instr); |
4620 | 4620 |
4621 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); | 4621 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); |
4622 Register char_code = ToRegister(instr->char_code()); | 4622 Register char_code = ToRegister(instr->char_code()); |
4623 Register result = ToRegister(instr->result()); | 4623 Register result = ToRegister(instr->result()); |
4624 ASSERT(!char_code.is(result)); | 4624 ASSERT(!char_code.is(result)); |
4625 | 4625 |
4626 __ cmp(char_code, Operand(String::kMaxAsciiCharCode)); | 4626 __ cmp(char_code, Operand(String::kMaxOneByteCharCode)); |
4627 __ b(hi, deferred->entry()); | 4627 __ b(hi, deferred->entry()); |
4628 __ LoadRoot(result, Heap::kSingleCharacterStringCacheRootIndex); | 4628 __ LoadRoot(result, Heap::kSingleCharacterStringCacheRootIndex); |
4629 __ add(result, result, Operand(char_code, LSL, kPointerSizeLog2)); | 4629 __ add(result, result, Operand(char_code, LSL, kPointerSizeLog2)); |
4630 __ ldr(result, FieldMemOperand(result, FixedArray::kHeaderSize)); | 4630 __ ldr(result, FieldMemOperand(result, FixedArray::kHeaderSize)); |
4631 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 4631 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
4632 __ cmp(result, ip); | 4632 __ cmp(result, ip); |
4633 __ b(eq, deferred->entry()); | 4633 __ b(eq, deferred->entry()); |
4634 __ bind(deferred->exit()); | 4634 __ bind(deferred->exit()); |
4635 } | 4635 } |
4636 | 4636 |
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6082 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 6082 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
6083 __ ldr(result, FieldMemOperand(scratch, | 6083 __ ldr(result, FieldMemOperand(scratch, |
6084 FixedArray::kHeaderSize - kPointerSize)); | 6084 FixedArray::kHeaderSize - kPointerSize)); |
6085 __ bind(&done); | 6085 __ bind(&done); |
6086 } | 6086 } |
6087 | 6087 |
6088 | 6088 |
6089 #undef __ | 6089 #undef __ |
6090 | 6090 |
6091 } } // namespace v8::internal | 6091 } } // namespace v8::internal |
OLD | NEW |