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

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

Issue 2877018: Refactor type checks in v8natives.js and runtime.js.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 6419 matching lines...) Expand 10 before | Expand all | Expand 10 after
6430 // ControlDestination, so we copy its implementation here. 6430 // ControlDestination, so we copy its implementation here.
6431 __ movzx_b(map.reg(), FieldOperand(map.reg(), Map::kInstanceTypeOffset)); 6431 __ movzx_b(map.reg(), FieldOperand(map.reg(), Map::kInstanceTypeOffset));
6432 __ sub(Operand(map.reg()), Immediate(FIRST_JS_OBJECT_TYPE)); 6432 __ sub(Operand(map.reg()), Immediate(FIRST_JS_OBJECT_TYPE));
6433 __ cmp(map.reg(), LAST_JS_OBJECT_TYPE - FIRST_JS_OBJECT_TYPE); 6433 __ cmp(map.reg(), LAST_JS_OBJECT_TYPE - FIRST_JS_OBJECT_TYPE);
6434 obj.Unuse(); 6434 obj.Unuse();
6435 map.Unuse(); 6435 map.Unuse();
6436 destination()->Split(below_equal); 6436 destination()->Split(below_equal);
6437 } 6437 }
6438 6438
6439 6439
6440 void CodeGenerator::GenerateIsSpecObject(ZoneList<Expression*>* args) {
6441 // This generates a fast version of:
6442 // (typeof(arg) === 'object' || %_ClassOf(arg) == 'RegExp' ||
6443 // typeof(arg) == function).
6444 // It includes undetectable objects (as opposed to IsObject).
6445 ASSERT(args->length() == 1);
6446 Load(args->at(0));
6447 Result value = frame_->Pop();
6448 value.ToRegister();
6449 ASSERT(value.is_valid());
6450 __ test(value.reg(), Immediate(kSmiTagMask));
6451 destination()->false_target()->Branch(equal);
6452
6453 // Check that this is an object.
6454 frame_->Spill(value.reg());
6455 __ CmpObjectType(value.reg(), FIRST_JS_OBJECT_TYPE, value.reg());
6456 value.Unuse();
6457 destination()->Split(above_equal);
6458 }
6459
6460
6440 void CodeGenerator::GenerateIsFunction(ZoneList<Expression*>* args) { 6461 void CodeGenerator::GenerateIsFunction(ZoneList<Expression*>* args) {
6441 // This generates a fast version of: 6462 // This generates a fast version of:
6442 // (%_ClassOf(arg) === 'Function') 6463 // (%_ClassOf(arg) === 'Function')
6443 ASSERT(args->length() == 1); 6464 ASSERT(args->length() == 1);
6444 Load(args->at(0)); 6465 Load(args->at(0));
6445 Result obj = frame_->Pop(); 6466 Result obj = frame_->Pop();
6446 obj.ToRegister(); 6467 obj.ToRegister();
6447 __ test(obj.reg(), Immediate(kSmiTagMask)); 6468 __ test(obj.reg(), Immediate(kSmiTagMask));
6448 destination()->false_target()->Branch(zero); 6469 destination()->false_target()->Branch(zero);
6449 Result temp = allocator()->Allocate(); 6470 Result temp = allocator()->Allocate();
(...skipping 7336 matching lines...) Expand 10 before | Expand all | Expand 10 after
13786 masm.GetCode(&desc); 13807 masm.GetCode(&desc);
13787 // Call the function from C++. 13808 // Call the function from C++.
13788 return FUNCTION_CAST<MemCopyFunction>(buffer); 13809 return FUNCTION_CAST<MemCopyFunction>(buffer);
13789 } 13810 }
13790 13811
13791 #undef __ 13812 #undef __
13792 13813
13793 } } // namespace v8::internal 13814 } } // namespace v8::internal
13794 13815
13795 #endif // V8_TARGET_ARCH_IA32 13816 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698