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

Unified Diff: src/macro-assembler-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/macro-assembler-ia32.cc
===================================================================
--- src/macro-assembler-ia32.cc (revision 1445)
+++ src/macro-assembler-ia32.cc (working copy)
@@ -305,7 +305,20 @@
mov(dst, x);
}
+void MacroAssembler::CmpObjectType(Register heap_object,
+ InstanceType type,
+ Register map) {
+ mov(map, FieldOperand(heap_object, HeapObject::kMapOffset));
+ CmpInstanceType(map, type);
+}
+
+void MacroAssembler::CmpInstanceType(Register map, InstanceType type) {
+ cmpb(FieldOperand(map, Map::kInstanceTypeOffset),
+ static_cast<int8_t>(type));
+}
+
+
void MacroAssembler::FCmp() {
fcompp();
push(eax);
@@ -657,9 +670,7 @@
j(zero, miss, not_taken);
// Check that the function really is a function.
- mov(result, FieldOperand(function, HeapObject::kMapOffset));
- movzx_b(scratch, FieldOperand(result, Map::kInstanceTypeOffset));
- cmp(scratch, JS_FUNCTION_TYPE);
+ CmpObjectType(function, JS_FUNCTION_TYPE, result);
j(not_equal, miss, not_taken);
// Make sure that the function has an instance prototype.
@@ -680,9 +691,7 @@
// If the function does not have an initial map, we're done.
Label done;
- mov(scratch, FieldOperand(result, HeapObject::kMapOffset));
- movzx_b(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset));
- cmp(scratch, MAP_TYPE);
+ CmpObjectType(result, MAP_TYPE, scratch);
j(not_equal, &done);
// Get the prototype from the initial map.
« src/builtins-ia32.cc ('K') | « src/macro-assembler-ia32.h ('k') | src/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698