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

Side by Side Diff: src/mips/lithium-codegen-mips.cc

Issue 1306303005: Revert of [es5] Class of object is "Function" if object has [[Call]]. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months 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
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved.7 1 // Copyright 2012 the V8 project authors. All rights reserved.7
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 2526 matching lines...) Expand 10 before | Expand all | Expand 10 after
2537 Handle<String>class_name, 2537 Handle<String>class_name,
2538 Register input, 2538 Register input,
2539 Register temp, 2539 Register temp,
2540 Register temp2) { 2540 Register temp2) {
2541 DCHECK(!input.is(temp)); 2541 DCHECK(!input.is(temp));
2542 DCHECK(!input.is(temp2)); 2542 DCHECK(!input.is(temp2));
2543 DCHECK(!temp.is(temp2)); 2543 DCHECK(!temp.is(temp2));
2544 2544
2545 __ JumpIfSmi(input, is_false); 2545 __ JumpIfSmi(input, is_false);
2546 2546
2547 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); 2547 if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
2548 __ GetObjectType(input, temp, temp2); 2548 // Assuming the following assertions, we can use the same compares to test
2549 __ Branch(is_false, lt, temp2, Operand(FIRST_JS_RECEIVER_TYPE)); 2549 // for both being a function type and being in the object type range.
2550 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
2551 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE ==
2552 FIRST_SPEC_OBJECT_TYPE + 1);
2553 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE ==
2554 LAST_SPEC_OBJECT_TYPE - 1);
2555 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
2550 2556
2551 // Objects with [[Call]] have class 'Function'. 2557 __ GetObjectType(input, temp, temp2);
2552 __ lbu(temp2, FieldMemOperand(temp, Map::kBitFieldOffset)); 2558 __ Branch(is_false, lt, temp2, Operand(FIRST_SPEC_OBJECT_TYPE));
2553 __ And(temp2, temp2, Operand(1 << Map::kIsCallable)); 2559 __ Branch(is_true, eq, temp2, Operand(FIRST_SPEC_OBJECT_TYPE));
2554 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { 2560 __ Branch(is_true, eq, temp2, Operand(LAST_SPEC_OBJECT_TYPE));
2555 __ Branch(is_true, ne, temp2, Operand(zero_reg));
2556 } else { 2561 } else {
2557 __ Branch(is_false, ne, temp2, Operand(zero_reg)); 2562 // Faster code path to avoid two compares: subtract lower bound from the
2563 // actual type and do a signed compare with the width of the type range.
2564 __ GetObjectType(input, temp, temp2);
2565 __ Subu(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE));
2566 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE -
2567 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE));
2558 } 2568 }
2559 2569
2560 // Now we are in the FIRST-LAST_JS_RECEIVER_TYPE range. 2570 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range.
2561 // Check if the constructor in the map is a function. 2571 // Check if the constructor in the map is a function.
2562 Register instance_type = scratch1(); 2572 Register instance_type = scratch1();
2563 DCHECK(!instance_type.is(temp)); 2573 DCHECK(!instance_type.is(temp));
2564 __ GetMapConstructor(temp, temp, temp2, instance_type); 2574 __ GetMapConstructor(temp, temp, temp2, instance_type);
2565 2575
2566 // Objects with a non-function constructor have class 'Object'. 2576 // Objects with a non-function constructor have class 'Object'.
2567 if (String::Equals(class_name, isolate()->factory()->Object_string())) { 2577 if (String::Equals(class_name, isolate()->factory()->Object_string())) {
2568 __ Branch(is_true, ne, instance_type, Operand(JS_FUNCTION_TYPE)); 2578 __ Branch(is_true, ne, instance_type, Operand(JS_FUNCTION_TYPE));
2569 } else { 2579 } else {
2570 __ Branch(is_false, ne, instance_type, Operand(JS_FUNCTION_TYPE)); 2580 __ Branch(is_false, ne, instance_type, Operand(JS_FUNCTION_TYPE));
(...skipping 3348 matching lines...) Expand 10 before | Expand all | Expand 10 after
5919 __ Push(at, ToRegister(instr->function())); 5929 __ Push(at, ToRegister(instr->function()));
5920 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5930 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5921 RecordSafepoint(Safepoint::kNoLazyDeopt); 5931 RecordSafepoint(Safepoint::kNoLazyDeopt);
5922 } 5932 }
5923 5933
5924 5934
5925 #undef __ 5935 #undef __
5926 5936
5927 } // namespace internal 5937 } // namespace internal
5928 } // namespace v8 5938 } // namespace v8
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698