Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: src/crankshaft/ia32/lithium-codegen-ia32.cc

Issue 1517673002: Fix Object.prototype.toString.call(proxy) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add test Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h"
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 2427 matching lines...) Expand 10 before | Expand all | Expand 10 after
2438 Register temp2) { 2438 Register temp2) {
2439 DCHECK(!input.is(temp)); 2439 DCHECK(!input.is(temp));
2440 DCHECK(!input.is(temp2)); 2440 DCHECK(!input.is(temp2));
2441 DCHECK(!temp.is(temp2)); 2441 DCHECK(!temp.is(temp2));
2442 __ JumpIfSmi(input, is_false); 2442 __ JumpIfSmi(input, is_false);
2443 2443
2444 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { 2444 if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
2445 // Assuming the following assertions, we can use the same compares to test 2445 // Assuming the following assertions, we can use the same compares to test
2446 // for both being a function type and being in the object type range. 2446 // for both being a function type and being in the object type range.
2447 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); 2447 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
2448 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE ==
2449 FIRST_JS_RECEIVER_TYPE + 1);
2450 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == 2448 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE ==
2451 LAST_JS_RECEIVER_TYPE - 1); 2449 LAST_JS_RECEIVER_TYPE - 1);
2452 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); 2450 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE);
2453 __ CmpObjectType(input, FIRST_JS_RECEIVER_TYPE, temp); 2451 __ CmpObjectType(input, FIRST_JS_RECEIVER_TYPE, temp);
2454 __ j(below, is_false); 2452 __ j(below, is_false);
2455 __ j(equal, is_true);
2456 __ CmpInstanceType(temp, LAST_JS_RECEIVER_TYPE); 2453 __ CmpInstanceType(temp, LAST_JS_RECEIVER_TYPE);
2457 __ j(equal, is_true); 2454 __ j(equal, is_true);
2458 } else { 2455 } else {
2459 // Faster code path to avoid two compares: subtract lower bound from the 2456 // Faster code path to avoid two compares: subtract lower bound from the
2460 // actual type and do a signed compare with the width of the type range. 2457 // actual type and do a signed compare with the width of the type range.
2461 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); 2458 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset));
2462 __ movzx_b(temp2, FieldOperand(temp, Map::kInstanceTypeOffset)); 2459 __ movzx_b(temp2, FieldOperand(temp, Map::kInstanceTypeOffset));
2463 __ sub(Operand(temp2), Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); 2460 __ sub(Operand(temp2), Immediate(FIRST_JS_RECEIVER_TYPE));
2464 __ cmp(Operand(temp2), Immediate(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - 2461 __ cmp(Operand(temp2), Immediate(LAST_NONCALLABLE_SPEC_OBJECT_TYPE -
2465 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); 2462 FIRST_JS_RECEIVER_TYPE));
2466 __ j(above, is_false); 2463 __ j(above, is_false);
2467 } 2464 }
2468 2465
2469 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. 2466 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range.
2470 // Check if the constructor in the map is a function. 2467 // Check if the constructor in the map is a function.
2471 __ GetMapConstructor(temp, temp, temp2); 2468 __ GetMapConstructor(temp, temp, temp2);
2472 // Objects with a non-function constructor have class 'Object'. 2469 // Objects with a non-function constructor have class 'Object'.
2473 __ CmpInstanceType(temp2, JS_FUNCTION_TYPE); 2470 __ CmpInstanceType(temp2, JS_FUNCTION_TYPE);
2474 if (String::Equals(class_name, isolate()->factory()->Object_string())) { 2471 if (String::Equals(class_name, isolate()->factory()->Object_string())) {
2475 __ j(not_equal, is_true); 2472 __ j(not_equal, is_true);
(...skipping 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after
5510 RecordSafepoint(Safepoint::kNoLazyDeopt); 5507 RecordSafepoint(Safepoint::kNoLazyDeopt);
5511 } 5508 }
5512 5509
5513 5510
5514 #undef __ 5511 #undef __
5515 5512
5516 } // namespace internal 5513 } // namespace internal
5517 } // namespace v8 5514 } // namespace v8
5518 5515
5519 #endif // V8_TARGET_ARCH_IA32 5516 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698