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

Side by Side Diff: src/arm/codegen-arm.cc

Issue 399111: Implement IS_OBJECT and IS_FUNCTION as inlined runtime functions.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/codegen-arm.h ('k') | src/codegen.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 3367 matching lines...) Expand 10 before | Expand all | Expand 10 after
3378 __ and_(r1, r0, Operand(kSmiTagMask)); 3378 __ and_(r1, r0, Operand(kSmiTagMask));
3379 __ eor(r1, r1, Operand(kSmiTagMask), SetCC); 3379 __ eor(r1, r1, Operand(kSmiTagMask), SetCC);
3380 answer.Branch(ne); 3380 answer.Branch(ne);
3381 // It is a heap object - get the map. Check if the object is a JS array. 3381 // It is a heap object - get the map. Check if the object is a JS array.
3382 __ CompareObjectType(r0, r1, r1, JS_ARRAY_TYPE); 3382 __ CompareObjectType(r0, r1, r1, JS_ARRAY_TYPE);
3383 answer.Bind(); 3383 answer.Bind();
3384 cc_reg_ = eq; 3384 cc_reg_ = eq;
3385 } 3385 }
3386 3386
3387 3387
3388 void CodeGenerator::GenerateIsObject(ZoneList<Expression*>* args) {
3389 // This generates a fast version of:
3390 // (typeof(arg) === 'object' || %_ClassOf(arg) == 'RegExp')
3391 VirtualFrame::SpilledScope spilled_scope;
3392 ASSERT(args->length() == 1);
3393 LoadAndSpill(args->at(0));
3394 frame_->EmitPop(r1);
3395 __ tst(r1, Operand(kSmiTagMask));
3396 false_target()->Branch(eq);
3397
3398 __ LoadRoot(ip, Heap::kNullValueRootIndex);
3399 __ cmp(r1, ip);
3400 true_target()->Branch(eq);
3401
3402 Register map_reg = r2;
3403 __ ldr(map_reg, FieldMemOperand(r1, HeapObject::kMapOffset));
3404 // Undetectable objects behave like undefined when tested with typeof.
3405 __ ldrb(r1, FieldMemOperand(map_reg, Map::kBitFieldOffset));
3406 __ and_(r1, r1, Operand(1 << Map::kIsUndetectable));
3407 __ cmp(r1, Operand(1 << Map::kIsUndetectable));
3408 false_target()->Branch(eq);
3409
3410 __ ldrb(r1, FieldMemOperand(map_reg, Map::kInstanceTypeOffset));
3411 __ cmp(r1, Operand(FIRST_JS_OBJECT_TYPE));
3412 false_target()->Branch(lt);
3413 __ cmp(r1, Operand(LAST_JS_OBJECT_TYPE));
3414 cc_reg_ = le;
3415 }
3416
3417
3418 void CodeGenerator::GenerateIsFunction(ZoneList<Expression*>* args) {
3419 // This generates a fast version of:
3420 // (%_ClassOf(arg) === 'Function')
3421 VirtualFrame::SpilledScope spilled_scope;
3422 ASSERT(args->length() == 1);
3423 LoadAndSpill(args->at(0));
3424 frame_->EmitPop(r0);
3425 __ tst(r0, Operand(kSmiTagMask));
3426 false_target()->Branch(eq);
3427 Register map_reg = r2;
3428 __ CompareObjectType(r0, map_reg, r1, JS_FUNCTION_TYPE);
3429 cc_reg_ = eq;
3430 }
3431
3432
3388 void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) { 3433 void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) {
3389 VirtualFrame::SpilledScope spilled_scope; 3434 VirtualFrame::SpilledScope spilled_scope;
3390 ASSERT(args->length() == 0); 3435 ASSERT(args->length() == 0);
3391 3436
3392 // Get the frame pointer for the calling frame. 3437 // Get the frame pointer for the calling frame.
3393 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 3438 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
3394 3439
3395 // Skip the arguments adaptor frame if it exists. 3440 // Skip the arguments adaptor frame if it exists.
3396 Label check_frame_marker; 3441 Label check_frame_marker;
3397 __ ldr(r1, MemOperand(r2, StandardFrameConstants::kContextOffset)); 3442 __ ldr(r1, MemOperand(r2, StandardFrameConstants::kContextOffset));
(...skipping 3030 matching lines...) Expand 10 before | Expand all | Expand 10 after
6428 int CompareStub::MinorKey() { 6473 int CompareStub::MinorKey() {
6429 // Encode the two parameters in a unique 16 bit value. 6474 // Encode the two parameters in a unique 16 bit value.
6430 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); 6475 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15));
6431 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); 6476 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0);
6432 } 6477 }
6433 6478
6434 6479
6435 #undef __ 6480 #undef __
6436 6481
6437 } } // namespace v8::internal 6482 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.h ('k') | src/codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698