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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 | 129 |
130 bool LCodeGen::GeneratePrologue() { | 130 bool LCodeGen::GeneratePrologue() { |
131 ASSERT(is_generating()); | 131 ASSERT(is_generating()); |
132 | 132 |
133 if (info()->IsOptimizing()) { | 133 if (info()->IsOptimizing()) { |
134 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 134 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
135 | 135 |
136 #ifdef DEBUG | 136 #ifdef DEBUG |
137 if (strlen(FLAG_stop_at) > 0 && | 137 if (strlen(FLAG_stop_at) > 0 && |
138 info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 138 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
139 __ int3(); | 139 __ int3(); |
140 } | 140 } |
141 #endif | 141 #endif |
142 | 142 |
143 // Strict mode functions and builtins need to replace the receiver | 143 // Strict mode functions and builtins need to replace the receiver |
144 // with undefined when called as functions (without an explicit | 144 // with undefined when called as functions (without an explicit |
145 // receiver object). ecx is zero for method calls and non-zero for | 145 // receiver object). ecx is zero for method calls and non-zero for |
146 // function calls. | 146 // function calls. |
147 if (!info_->is_classic_mode() || info_->is_native()) { | 147 if (!info_->is_classic_mode() || info_->is_native()) { |
148 Label ok; | 148 Label ok; |
(...skipping 2255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2404 Label* is_false, | 2404 Label* is_false, |
2405 Handle<String>class_name, | 2405 Handle<String>class_name, |
2406 Register input, | 2406 Register input, |
2407 Register temp, | 2407 Register temp, |
2408 Register temp2) { | 2408 Register temp2) { |
2409 ASSERT(!input.is(temp)); | 2409 ASSERT(!input.is(temp)); |
2410 ASSERT(!input.is(temp2)); | 2410 ASSERT(!input.is(temp2)); |
2411 ASSERT(!temp.is(temp2)); | 2411 ASSERT(!temp.is(temp2)); |
2412 __ JumpIfSmi(input, is_false); | 2412 __ JumpIfSmi(input, is_false); |
2413 | 2413 |
2414 if (class_name->IsEqualTo(CStrVector("Function"))) { | 2414 if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Function"))) { |
2415 // Assuming the following assertions, we can use the same compares to test | 2415 // Assuming the following assertions, we can use the same compares to test |
2416 // for both being a function type and being in the object type range. | 2416 // for both being a function type and being in the object type range. |
2417 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 2417 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
2418 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2418 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == |
2419 FIRST_SPEC_OBJECT_TYPE + 1); | 2419 FIRST_SPEC_OBJECT_TYPE + 1); |
2420 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2420 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
2421 LAST_SPEC_OBJECT_TYPE - 1); | 2421 LAST_SPEC_OBJECT_TYPE - 1); |
2422 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 2422 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
2423 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp); | 2423 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp); |
2424 __ j(below, is_false); | 2424 __ j(below, is_false); |
2425 __ j(equal, is_true); | 2425 __ j(equal, is_true); |
2426 __ CmpInstanceType(temp, LAST_SPEC_OBJECT_TYPE); | 2426 __ CmpInstanceType(temp, LAST_SPEC_OBJECT_TYPE); |
2427 __ j(equal, is_true); | 2427 __ j(equal, is_true); |
2428 } else { | 2428 } else { |
2429 // Faster code path to avoid two compares: subtract lower bound from the | 2429 // Faster code path to avoid two compares: subtract lower bound from the |
2430 // actual type and do a signed compare with the width of the type range. | 2430 // actual type and do a signed compare with the width of the type range. |
2431 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); | 2431 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); |
2432 __ movzx_b(temp2, FieldOperand(temp, Map::kInstanceTypeOffset)); | 2432 __ movzx_b(temp2, FieldOperand(temp, Map::kInstanceTypeOffset)); |
2433 __ sub(Operand(temp2), Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2433 __ sub(Operand(temp2), Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
2434 __ cmp(Operand(temp2), Immediate(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - | 2434 __ cmp(Operand(temp2), Immediate(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - |
2435 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2435 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
2436 __ j(above, is_false); | 2436 __ j(above, is_false); |
2437 } | 2437 } |
2438 | 2438 |
2439 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | 2439 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. |
2440 // Check if the constructor in the map is a function. | 2440 // Check if the constructor in the map is a function. |
2441 __ mov(temp, FieldOperand(temp, Map::kConstructorOffset)); | 2441 __ mov(temp, FieldOperand(temp, Map::kConstructorOffset)); |
2442 // Objects with a non-function constructor have class 'Object'. | 2442 // Objects with a non-function constructor have class 'Object'. |
2443 __ CmpObjectType(temp, JS_FUNCTION_TYPE, temp2); | 2443 __ CmpObjectType(temp, JS_FUNCTION_TYPE, temp2); |
2444 if (class_name->IsEqualTo(CStrVector("Object"))) { | 2444 if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Object"))) { |
2445 __ j(not_equal, is_true); | 2445 __ j(not_equal, is_true); |
2446 } else { | 2446 } else { |
2447 __ j(not_equal, is_false); | 2447 __ j(not_equal, is_false); |
2448 } | 2448 } |
2449 | 2449 |
2450 // temp now contains the constructor function. Grab the | 2450 // temp now contains the constructor function. Grab the |
2451 // instance class name from there. | 2451 // instance class name from there. |
2452 __ mov(temp, FieldOperand(temp, JSFunction::kSharedFunctionInfoOffset)); | 2452 __ mov(temp, FieldOperand(temp, JSFunction::kSharedFunctionInfoOffset)); |
2453 __ mov(temp, FieldOperand(temp, | 2453 __ mov(temp, FieldOperand(temp, |
2454 SharedFunctionInfo::kInstanceClassNameOffset)); | 2454 SharedFunctionInfo::kInstanceClassNameOffset)); |
(...skipping 1970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4425 }; | 4425 }; |
4426 | 4426 |
4427 DeferredStringCharFromCode* deferred = | 4427 DeferredStringCharFromCode* deferred = |
4428 new(zone()) DeferredStringCharFromCode(this, instr); | 4428 new(zone()) DeferredStringCharFromCode(this, instr); |
4429 | 4429 |
4430 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); | 4430 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); |
4431 Register char_code = ToRegister(instr->char_code()); | 4431 Register char_code = ToRegister(instr->char_code()); |
4432 Register result = ToRegister(instr->result()); | 4432 Register result = ToRegister(instr->result()); |
4433 ASSERT(!char_code.is(result)); | 4433 ASSERT(!char_code.is(result)); |
4434 | 4434 |
4435 __ cmp(char_code, String::kMaxAsciiCharCode); | 4435 __ cmp(char_code, String::kMaxOneByteCharCode); |
4436 __ j(above, deferred->entry()); | 4436 __ j(above, deferred->entry()); |
4437 __ Set(result, Immediate(factory()->single_character_string_cache())); | 4437 __ Set(result, Immediate(factory()->single_character_string_cache())); |
4438 __ mov(result, FieldOperand(result, | 4438 __ mov(result, FieldOperand(result, |
4439 char_code, times_pointer_size, | 4439 char_code, times_pointer_size, |
4440 FixedArray::kHeaderSize)); | 4440 FixedArray::kHeaderSize)); |
4441 __ cmp(result, factory()->undefined_value()); | 4441 __ cmp(result, factory()->undefined_value()); |
4442 __ j(equal, deferred->entry()); | 4442 __ j(equal, deferred->entry()); |
4443 __ bind(deferred->exit()); | 4443 __ bind(deferred->exit()); |
4444 } | 4444 } |
4445 | 4445 |
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5955 FixedArray::kHeaderSize - kPointerSize)); | 5955 FixedArray::kHeaderSize - kPointerSize)); |
5956 __ bind(&done); | 5956 __ bind(&done); |
5957 } | 5957 } |
5958 | 5958 |
5959 | 5959 |
5960 #undef __ | 5960 #undef __ |
5961 | 5961 |
5962 } } // namespace v8::internal | 5962 } } // namespace v8::internal |
5963 | 5963 |
5964 #endif // V8_TARGET_ARCH_IA32 | 5964 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |