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

Side by Side Diff: src/x64/codegen-x64.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/x64/codegen-x64.h ('k') | src/x64/full-codegen-x64.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 5705 matching lines...) Expand 10 before | Expand all | Expand 10 after
5716 __ movzxbq(kScratchRegister, 5716 __ movzxbq(kScratchRegister,
5717 FieldOperand(kScratchRegister, Map::kInstanceTypeOffset)); 5717 FieldOperand(kScratchRegister, Map::kInstanceTypeOffset));
5718 __ cmpq(kScratchRegister, Immediate(FIRST_JS_OBJECT_TYPE)); 5718 __ cmpq(kScratchRegister, Immediate(FIRST_JS_OBJECT_TYPE));
5719 destination()->false_target()->Branch(below); 5719 destination()->false_target()->Branch(below);
5720 __ cmpq(kScratchRegister, Immediate(LAST_JS_OBJECT_TYPE)); 5720 __ cmpq(kScratchRegister, Immediate(LAST_JS_OBJECT_TYPE));
5721 obj.Unuse(); 5721 obj.Unuse();
5722 destination()->Split(below_equal); 5722 destination()->Split(below_equal);
5723 } 5723 }
5724 5724
5725 5725
5726 void CodeGenerator::GenerateIsSpecObject(ZoneList<Expression*>* args) {
5727 // This generates a fast version of:
5728 // (typeof(arg) === 'object' || %_ClassOf(arg) == 'RegExp' ||
5729 // typeof(arg) == function).
5730 // It includes undetectable objects (as opposed to IsObject).
5731 ASSERT(args->length() == 1);
5732 Load(args->at(0));
5733 Result value = frame_->Pop();
5734 value.ToRegister();
5735 ASSERT(value.is_valid());
5736 Condition is_smi = masm_->CheckSmi(value.reg());
5737 destination()->false_target()->Branch(is_smi);
5738 // Check that this is an object.
5739 __ CmpObjectType(value.reg(), FIRST_JS_OBJECT_TYPE, kScratchRegister);
5740 value.Unuse();
5741 destination()->Split(above_equal);
5742 }
5743
5744
5726 void CodeGenerator::GenerateIsFunction(ZoneList<Expression*>* args) { 5745 void CodeGenerator::GenerateIsFunction(ZoneList<Expression*>* args) {
5727 // This generates a fast version of: 5746 // This generates a fast version of:
5728 // (%_ClassOf(arg) === 'Function') 5747 // (%_ClassOf(arg) === 'Function')
5729 ASSERT(args->length() == 1); 5748 ASSERT(args->length() == 1);
5730 Load(args->at(0)); 5749 Load(args->at(0));
5731 Result obj = frame_->Pop(); 5750 Result obj = frame_->Pop();
5732 obj.ToRegister(); 5751 obj.ToRegister();
5733 Condition is_smi = masm_->CheckSmi(obj.reg()); 5752 Condition is_smi = masm_->CheckSmi(obj.reg());
5734 destination()->false_target()->Branch(is_smi); 5753 destination()->false_target()->Branch(is_smi);
5735 __ CmpObjectType(obj.reg(), JS_FUNCTION_TYPE, kScratchRegister); 5754 __ CmpObjectType(obj.reg(), JS_FUNCTION_TYPE, kScratchRegister);
(...skipping 6364 matching lines...) Expand 10 before | Expand all | Expand 10 after
12100 #undef __ 12119 #undef __
12101 12120
12102 void RecordWriteStub::Generate(MacroAssembler* masm) { 12121 void RecordWriteStub::Generate(MacroAssembler* masm) {
12103 masm->RecordWriteHelper(object_, addr_, scratch_); 12122 masm->RecordWriteHelper(object_, addr_, scratch_);
12104 masm->ret(0); 12123 masm->ret(0);
12105 } 12124 }
12106 12125
12107 } } // namespace v8::internal 12126 } } // namespace v8::internal
12108 12127
12109 #endif // V8_TARGET_ARCH_X64 12128 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/codegen-x64.h ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698