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

Unified Diff: src/codegen-ia32.cc

Issue 39336: Refactored the code for comparing the type of an object with a constant.... Base URL: http://v8.googlecode.com/svn/branches/experimental/global/
Patch Set: Created 11 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: src/codegen-ia32.cc
===================================================================
--- src/codegen-ia32.cc (revision 1445)
+++ src/codegen-ia32.cc (working copy)
@@ -1934,9 +1934,7 @@
// heap number.
Result temp = allocator()->Allocate();
ASSERT(temp.is_valid());
- __ mov(temp.reg(), FieldOperand(switch_value.reg(), HeapObject::kMapOffset));
- __ movzx_b(temp.reg(), FieldOperand(temp.reg(), Map::kInstanceTypeOffset));
- __ cmp(temp.reg(), HEAP_NUMBER_TYPE);
+ __ CmpObjectType(switch_value.reg(), HEAP_NUMBER_TYPE, temp.reg());
temp.Unuse();
default_target->Branch(not_equal);
@@ -4122,10 +4120,8 @@
// It is a heap object - get map.
Result temp = allocator()->Allocate();
ASSERT(temp.is_valid());
- __ mov(temp.reg(), FieldOperand(value.reg(), HeapObject::kMapOffset));
- __ movzx_b(temp.reg(), FieldOperand(temp.reg(), Map::kInstanceTypeOffset));
// Check if the object is a JS array or not.
- __ cmp(temp.reg(), JS_ARRAY_TYPE);
+ __ CmpObjectType(value.reg(), JS_ARRAY_TYPE, temp.reg());
value.Unuse();
temp.Unuse();
destination()->Split(equal);
@@ -4161,10 +4157,8 @@
// It is a heap object - get map.
Result temp = allocator()->Allocate();
ASSERT(temp.is_valid());
- __ mov(temp.reg(), FieldOperand(object.reg(), HeapObject::kMapOffset));
- __ movzx_b(temp.reg(), FieldOperand(temp.reg(), Map::kInstanceTypeOffset));
// if (!object->IsJSValue()) return object.
- __ cmp(temp.reg(), JS_VALUE_TYPE);
+ __ CmpObjectType(object.reg(), JS_VALUE_TYPE, temp.reg());
leave.Branch(not_equal, not_taken);
__ mov(temp.reg(), FieldOperand(object.reg(), JSValue::kValueOffset));
object.Unuse();
@@ -4190,11 +4184,8 @@
// It is a heap object - get its map.
Result scratch = allocator_->Allocate();
ASSERT(scratch.is_valid());
- __ mov(scratch.reg(), FieldOperand(object.reg(), HeapObject::kMapOffset));
- __ movzx_b(scratch.reg(),
- FieldOperand(scratch.reg(), Map::kInstanceTypeOffset));
// if (!object->IsJSValue()) return value.
- __ cmp(scratch.reg(), JS_VALUE_TYPE);
+ __ CmpObjectType(object.reg(), JS_VALUE_TYPE, scratch.reg());
leave.Branch(not_equal, &value, not_taken);
// Store the value.
@@ -4908,10 +4899,7 @@
__ test(answer.reg(), Immediate(kSmiTagMask));
destination()->false_target()->Branch(zero);
frame_->Spill(answer.reg());
- __ mov(answer.reg(), FieldOperand(answer.reg(), HeapObject::kMapOffset));
- __ movzx_b(answer.reg(),
- FieldOperand(answer.reg(), Map::kInstanceTypeOffset));
- __ cmp(answer.reg(), JS_FUNCTION_TYPE);
+ __ CmpObjectType(answer.reg(), JS_FUNCTION_TYPE, answer.reg());
answer.Unuse();
destination()->Split(equal);
@@ -6408,10 +6396,8 @@
// Check that the function really is a JavaScript function.
__ test(edi, Immediate(kSmiTagMask));
__ j(zero, &slow, not_taken);
- // Get the map.
- __ mov(ecx, FieldOperand(edi, HeapObject::kMapOffset));
- __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
- __ cmp(ecx, JS_FUNCTION_TYPE);
+ // Goto slow case if we do not have a function.
+ __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
__ j(not_equal, &slow, not_taken);
// Fast-case: Just invoke the function.
« src/builtins-ia32.cc ('K') | « src/builtins-ia32.cc ('k') | src/ic-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698