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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 113 } |
114 | 114 |
115 | 115 |
116 bool LCodeGen::GeneratePrologue() { | 116 bool LCodeGen::GeneratePrologue() { |
117 ASSERT(is_generating()); | 117 ASSERT(is_generating()); |
118 | 118 |
119 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 119 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
120 | 120 |
121 #ifdef DEBUG | 121 #ifdef DEBUG |
122 if (strlen(FLAG_stop_at) > 0 && | 122 if (strlen(FLAG_stop_at) > 0 && |
123 info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 123 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
124 __ stop("stop_at"); | 124 __ stop("stop_at"); |
125 } | 125 } |
126 #endif | 126 #endif |
127 | 127 |
128 // a1: Callee's JS function. | 128 // a1: Callee's JS function. |
129 // cp: Callee's context. | 129 // cp: Callee's context. |
130 // fp: Caller's frame pointer. | 130 // fp: Caller's frame pointer. |
131 // lr: Caller's pc. | 131 // lr: Caller's pc. |
132 | 132 |
133 // Strict mode functions and builtins need to replace the receiver | 133 // Strict mode functions and builtins need to replace the receiver |
(...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 Handle<String>class_name, | 2081 Handle<String>class_name, |
2082 Register input, | 2082 Register input, |
2083 Register temp, | 2083 Register temp, |
2084 Register temp2) { | 2084 Register temp2) { |
2085 ASSERT(!input.is(temp)); | 2085 ASSERT(!input.is(temp)); |
2086 ASSERT(!input.is(temp2)); | 2086 ASSERT(!input.is(temp2)); |
2087 ASSERT(!temp.is(temp2)); | 2087 ASSERT(!temp.is(temp2)); |
2088 | 2088 |
2089 __ JumpIfSmi(input, is_false); | 2089 __ JumpIfSmi(input, is_false); |
2090 | 2090 |
2091 if (class_name->IsEqualTo(CStrVector("Function"))) { | 2091 if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Function"))) { |
2092 // Assuming the following assertions, we can use the same compares to test | 2092 // Assuming the following assertions, we can use the same compares to test |
2093 // for both being a function type and being in the object type range. | 2093 // for both being a function type and being in the object type range. |
2094 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 2094 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
2095 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2095 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == |
2096 FIRST_SPEC_OBJECT_TYPE + 1); | 2096 FIRST_SPEC_OBJECT_TYPE + 1); |
2097 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2097 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
2098 LAST_SPEC_OBJECT_TYPE - 1); | 2098 LAST_SPEC_OBJECT_TYPE - 1); |
2099 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 2099 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
2100 | 2100 |
2101 __ GetObjectType(input, temp, temp2); | 2101 __ GetObjectType(input, temp, temp2); |
2102 __ Branch(is_false, lt, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2102 __ Branch(is_false, lt, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); |
2103 __ Branch(is_true, eq, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2103 __ Branch(is_true, eq, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); |
2104 __ Branch(is_true, eq, temp2, Operand(LAST_SPEC_OBJECT_TYPE)); | 2104 __ Branch(is_true, eq, temp2, Operand(LAST_SPEC_OBJECT_TYPE)); |
2105 } else { | 2105 } else { |
2106 // Faster code path to avoid two compares: subtract lower bound from the | 2106 // Faster code path to avoid two compares: subtract lower bound from the |
2107 // actual type and do a signed compare with the width of the type range. | 2107 // actual type and do a signed compare with the width of the type range. |
2108 __ GetObjectType(input, temp, temp2); | 2108 __ GetObjectType(input, temp, temp2); |
2109 __ Subu(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2109 __ Subu(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
2110 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - | 2110 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - |
2111 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2111 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
2112 } | 2112 } |
2113 | 2113 |
2114 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | 2114 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. |
2115 // Check if the constructor in the map is a function. | 2115 // Check if the constructor in the map is a function. |
2116 __ lw(temp, FieldMemOperand(temp, Map::kConstructorOffset)); | 2116 __ lw(temp, FieldMemOperand(temp, Map::kConstructorOffset)); |
2117 | 2117 |
2118 // Objects with a non-function constructor have class 'Object'. | 2118 // Objects with a non-function constructor have class 'Object'. |
2119 __ GetObjectType(temp, temp2, temp2); | 2119 __ GetObjectType(temp, temp2, temp2); |
2120 if (class_name->IsEqualTo(CStrVector("Object"))) { | 2120 if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Object"))) { |
2121 __ Branch(is_true, ne, temp2, Operand(JS_FUNCTION_TYPE)); | 2121 __ Branch(is_true, ne, temp2, Operand(JS_FUNCTION_TYPE)); |
2122 } else { | 2122 } else { |
2123 __ Branch(is_false, ne, temp2, Operand(JS_FUNCTION_TYPE)); | 2123 __ Branch(is_false, ne, temp2, Operand(JS_FUNCTION_TYPE)); |
2124 } | 2124 } |
2125 | 2125 |
2126 // temp now contains the constructor function. Grab the | 2126 // temp now contains the constructor function. Grab the |
2127 // instance class name from there. | 2127 // instance class name from there. |
2128 __ lw(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); | 2128 __ lw(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); |
2129 __ lw(temp, FieldMemOperand(temp, | 2129 __ lw(temp, FieldMemOperand(temp, |
2130 SharedFunctionInfo::kInstanceClassNameOffset)); | 2130 SharedFunctionInfo::kInstanceClassNameOffset)); |
(...skipping 1987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4118 DeferredStringCharFromCode* deferred = | 4118 DeferredStringCharFromCode* deferred = |
4119 new(zone()) DeferredStringCharFromCode(this, instr); | 4119 new(zone()) DeferredStringCharFromCode(this, instr); |
4120 | 4120 |
4121 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); | 4121 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); |
4122 Register char_code = ToRegister(instr->char_code()); | 4122 Register char_code = ToRegister(instr->char_code()); |
4123 Register result = ToRegister(instr->result()); | 4123 Register result = ToRegister(instr->result()); |
4124 Register scratch = scratch0(); | 4124 Register scratch = scratch0(); |
4125 ASSERT(!char_code.is(result)); | 4125 ASSERT(!char_code.is(result)); |
4126 | 4126 |
4127 __ Branch(deferred->entry(), hi, | 4127 __ Branch(deferred->entry(), hi, |
4128 char_code, Operand(String::kMaxAsciiCharCode)); | 4128 char_code, Operand(String::kMaxOneByteCharCode)); |
4129 __ LoadRoot(result, Heap::kSingleCharacterStringCacheRootIndex); | 4129 __ LoadRoot(result, Heap::kSingleCharacterStringCacheRootIndex); |
4130 __ sll(scratch, char_code, kPointerSizeLog2); | 4130 __ sll(scratch, char_code, kPointerSizeLog2); |
4131 __ Addu(result, result, scratch); | 4131 __ Addu(result, result, scratch); |
4132 __ lw(result, FieldMemOperand(result, FixedArray::kHeaderSize)); | 4132 __ lw(result, FieldMemOperand(result, FixedArray::kHeaderSize)); |
4133 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | 4133 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
4134 __ Branch(deferred->entry(), eq, result, Operand(scratch)); | 4134 __ Branch(deferred->entry(), eq, result, Operand(scratch)); |
4135 __ bind(deferred->exit()); | 4135 __ bind(deferred->exit()); |
4136 } | 4136 } |
4137 | 4137 |
4138 | 4138 |
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5521 __ Subu(scratch, result, scratch); | 5521 __ Subu(scratch, result, scratch); |
5522 __ lw(result, FieldMemOperand(scratch, | 5522 __ lw(result, FieldMemOperand(scratch, |
5523 FixedArray::kHeaderSize - kPointerSize)); | 5523 FixedArray::kHeaderSize - kPointerSize)); |
5524 __ bind(&done); | 5524 __ bind(&done); |
5525 } | 5525 } |
5526 | 5526 |
5527 | 5527 |
5528 #undef __ | 5528 #undef __ |
5529 | 5529 |
5530 } } // namespace v8::internal | 5530 } } // namespace v8::internal |
OLD | NEW |