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

Side by Side Diff: src/full-codegen/arm64/full-codegen-arm64.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/full-codegen/arm/full-codegen-arm.cc ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('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 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 #if V8_TARGET_ARCH_ARM64 5 #if V8_TARGET_ARCH_ARM64
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 3372 matching lines...) Expand 10 before | Expand all | Expand 10 after
3383 __ Ldr(x0, MemOperand(x12, ArgumentsAdaptorFrameConstants::kLengthOffset)); 3383 __ Ldr(x0, MemOperand(x12, ArgumentsAdaptorFrameConstants::kLengthOffset));
3384 3384
3385 __ Bind(&exit); 3385 __ Bind(&exit);
3386 context()->Plug(x0); 3386 context()->Plug(x0);
3387 } 3387 }
3388 3388
3389 3389
3390 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { 3390 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
3391 ASM_LOCATION("FullCodeGenerator::EmitClassOf"); 3391 ASM_LOCATION("FullCodeGenerator::EmitClassOf");
3392 ZoneList<Expression*>* args = expr->arguments(); 3392 ZoneList<Expression*>* args = expr->arguments();
3393 DCHECK_EQ(1, args->length()); 3393 DCHECK(args->length() == 1);
3394 Label done, null, function, non_function_constructor; 3394 Label done, null, function, non_function_constructor;
3395 3395
3396 VisitForAccumulatorValue(args->at(0)); 3396 VisitForAccumulatorValue(args->at(0));
3397 3397
3398 // If the object is a smi, we return null. 3398 // If the object is a smi, we return null.
3399 __ JumpIfSmi(x0, &null); 3399 __ JumpIfSmi(x0, &null);
3400 3400
3401 // If the object is not a receiver, we return null. 3401 // Check that the object is a JS object but take special care of JS
3402 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); 3402 // functions to make sure they have 'Function' as their class.
3403 __ CompareObjectType(x0, x10, x11, FIRST_JS_RECEIVER_TYPE); 3403 // Assume that there are only two callable types, and one of them is at
3404 // either end of the type range for JS object types. Saves extra comparisons.
3405 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
3406 __ CompareObjectType(x0, x10, x11, FIRST_SPEC_OBJECT_TYPE);
3404 // x10: object's map. 3407 // x10: object's map.
3405 // x11: object's type. 3408 // x11: object's type.
3406 __ B(lt, &null); 3409 __ B(lt, &null);
3410 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE ==
3411 FIRST_SPEC_OBJECT_TYPE + 1);
3412 __ B(eq, &function);
3407 3413
3408 // According to ES5 section 15 Standard Built-in ECMAScript Objects, the 3414 __ Cmp(x11, LAST_SPEC_OBJECT_TYPE);
3409 // [[Class]] of builtin objects is "Function" if a [[Call]] internal 3415 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE ==
3410 // method is present. 3416 LAST_SPEC_OBJECT_TYPE - 1);
3411 __ Ldrb(x11, FieldMemOperand(x10, Map::kBitFieldOffset)); 3417 __ B(eq, &function);
3412 __ Tst(x11, 1 << Map::kIsCallable); 3418 // Assume that there is no larger type.
3413 __ B(ne, &function); 3419 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1);
3414 3420
3415 // Check if the constructor in the map is a JS function. 3421 // Check if the constructor in the map is a JS function.
3416 Register instance_type = x14; 3422 Register instance_type = x14;
3417 __ GetMapConstructor(x12, x10, x13, instance_type); 3423 __ GetMapConstructor(x12, x10, x13, instance_type);
3418 __ Cmp(instance_type, JS_FUNCTION_TYPE); 3424 __ Cmp(instance_type, JS_FUNCTION_TYPE);
3419 __ B(ne, &non_function_constructor); 3425 __ B(ne, &non_function_constructor);
3420 3426
3421 // x12 now contains the constructor function. Grab the 3427 // x12 now contains the constructor function. Grab the
3422 // instance class name from there. 3428 // instance class name from there.
3423 __ Ldr(x13, FieldMemOperand(x12, JSFunction::kSharedFunctionInfoOffset)); 3429 __ Ldr(x13, FieldMemOperand(x12, JSFunction::kSharedFunctionInfoOffset));
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after
5332 } 5338 }
5333 5339
5334 return INTERRUPT; 5340 return INTERRUPT;
5335 } 5341 }
5336 5342
5337 5343
5338 } // namespace internal 5344 } // namespace internal
5339 } // namespace v8 5345 } // namespace v8
5340 5346
5341 #endif // V8_TARGET_ARCH_ARM64 5347 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/full-codegen/arm/full-codegen-arm.cc ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698