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

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

Issue 1307943013: [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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #include "src/arm64/frames-arm64.h" 5 #include "src/arm64/frames-arm64.h"
6 #include "src/arm64/lithium-codegen-arm64.h" 6 #include "src/arm64/lithium-codegen-arm64.h"
7 #include "src/arm64/lithium-gap-resolver-arm64.h" 7 #include "src/arm64/lithium-gap-resolver-arm64.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 Handle<String> class_name = instr->hydrogen()->class_name(); 2348 Handle<String> class_name = instr->hydrogen()->class_name();
2349 Label* true_label = instr->TrueLabel(chunk_); 2349 Label* true_label = instr->TrueLabel(chunk_);
2350 Label* false_label = instr->FalseLabel(chunk_); 2350 Label* false_label = instr->FalseLabel(chunk_);
2351 Register input = ToRegister(instr->value()); 2351 Register input = ToRegister(instr->value());
2352 Register scratch1 = ToRegister(instr->temp1()); 2352 Register scratch1 = ToRegister(instr->temp1());
2353 Register scratch2 = ToRegister(instr->temp2()); 2353 Register scratch2 = ToRegister(instr->temp2());
2354 2354
2355 __ JumpIfSmi(input, false_label); 2355 __ JumpIfSmi(input, false_label);
2356 2356
2357 Register map = scratch2; 2357 Register map = scratch2;
2358 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE);
2359 __ CompareObjectType(input, map, scratch1, FIRST_JS_RECEIVER_TYPE);
2360 __ B(lt, false_label);
2361
2362 // Objects with [[Call]] have class 'Function'.
2363 __ Ldrb(scratch2, FieldMemOperand(map, Map::kBitFieldOffset));
2364 __ Tst(scratch2, 1 << Map::kIsCallable);
2358 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { 2365 if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
2359 // Assuming the following assertions, we can use the same compares to test 2366 __ B(ne, true_label);
2360 // for both being a function type and being in the object type range.
2361 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
2362 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE ==
2363 FIRST_SPEC_OBJECT_TYPE + 1);
2364 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE ==
2365 LAST_SPEC_OBJECT_TYPE - 1);
2366 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
2367
2368 // We expect CompareObjectType to load the object instance type in scratch1.
2369 __ CompareObjectType(input, map, scratch1, FIRST_SPEC_OBJECT_TYPE);
2370 __ B(lt, false_label);
2371 __ B(eq, true_label);
2372 __ Cmp(scratch1, LAST_SPEC_OBJECT_TYPE);
2373 __ B(eq, true_label);
2374 } else { 2367 } else {
2375 __ IsObjectJSObjectType(input, map, scratch1, false_label); 2368 __ B(ne, false_label);
2376 } 2369 }
2377 2370
2378 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. 2371 // Now we are in the FIRST-LAST_JS_RECEIVER_TYPE range.
2379 // Check if the constructor in the map is a function. 2372 // Check if the constructor in the map is a function.
2380 { 2373 {
2381 UseScratchRegisterScope temps(masm()); 2374 UseScratchRegisterScope temps(masm());
2382 Register instance_type = temps.AcquireX(); 2375 Register instance_type = temps.AcquireX();
2383 __ GetMapConstructor(scratch1, map, scratch2, instance_type); 2376 __ GetMapConstructor(scratch1, map, scratch2, instance_type);
2384 __ Cmp(instance_type, JS_FUNCTION_TYPE); 2377 __ Cmp(instance_type, JS_FUNCTION_TYPE);
2385 } 2378 }
2386 // Objects with a non-function constructor have class 'Object'. 2379 // Objects with a non-function constructor have class 'Object'.
2387 if (String::Equals(class_name, isolate()->factory()->Object_string())) { 2380 if (String::Equals(class_name, isolate()->factory()->Object_string())) {
2388 __ B(ne, true_label); 2381 __ B(ne, true_label);
(...skipping 3659 matching lines...) Expand 10 before | Expand all | Expand 10 after
6048 Handle<ScopeInfo> scope_info = instr->scope_info(); 6041 Handle<ScopeInfo> scope_info = instr->scope_info();
6049 __ Push(scope_info); 6042 __ Push(scope_info);
6050 __ Push(ToRegister(instr->function())); 6043 __ Push(ToRegister(instr->function()));
6051 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6044 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6052 RecordSafepoint(Safepoint::kNoLazyDeopt); 6045 RecordSafepoint(Safepoint::kNoLazyDeopt);
6053 } 6046 }
6054 6047
6055 6048
6056 } // namespace internal 6049 } // namespace internal
6057 } // namespace v8 6050 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698