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

Unified Diff: src/macro-assembler-ia32.cc

Issue 39337: Reduced the code sequence for testing for object type.... Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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
« no previous file with comments | « src/macro-assembler-ia32.h ('k') | src/stub-cache-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/macro-assembler-ia32.cc
===================================================================
--- src/macro-assembler-ia32.cc (revision 1451)
+++ src/macro-assembler-ia32.cc (working copy)
@@ -306,6 +306,20 @@
}
+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 +671,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 +692,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.
« no previous file with comments | « 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