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

Unified Diff: src/x64/lithium-codegen-x64.cc

Issue 10542137: Fix r11780 to avoid bugs where near branches are used to labels that are out of range. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 8 years, 6 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/ia32/lithium-codegen-ia32.cc ('k') | test/mjsunit/regress/regress-deep-proto.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/lithium-codegen-x64.cc
===================================================================
--- src/x64/lithium-codegen-x64.cc (revision 11789)
+++ src/x64/lithium-codegen-x64.cc (working copy)
@@ -2233,6 +2233,18 @@
}
+// Check for cases where EmitLoadFieldOrConstantFunction needs to walk the
+// prototype chain, which causes unbounded code generation.
+static bool CompactEmit(
+ SmallMapList* list, Handle<String> name, int i, Isolate* isolate) {
+ LookupResult lookup(isolate);
+ Handle<Map> map = list->at(i);
+ map->LookupInDescriptors(NULL, *name, &lookup);
+ return lookup.IsFound() &&
+ (lookup.type() == FIELD || lookup.type() == CONSTANT_FUNCTION);
+}
+
+
void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) {
Register object = ToRegister(instr->object());
Register result = ToRegister(instr->result());
@@ -2246,16 +2258,10 @@
}
Handle<String> name = instr->hydrogen()->name();
Label done;
- bool compact_code = true;
+ bool all_are_compact = true;
for (int i = 0; i < map_count; ++i) {
- LookupResult lookup(isolate());
- Handle<Map> map = instr->hydrogen()->types()->at(i);
- map->LookupInDescriptors(NULL, *name, &lookup);
- if (!lookup.IsFound() ||
- (lookup.type() != FIELD && lookup.type() != CONSTANT_FUNCTION)) {
- // The two cases above cause a bounded amount of code to be emitted. This
- // is not necessarily the case for other lookup results.
- compact_code = false;
+ if (!CompactEmit(instr->hydrogen()->types(), name, i, isolate())) {
+ all_are_compact = false;
break;
}
}
@@ -2271,11 +2277,13 @@
result, object, map, name, instr->environment());
} else {
Label next;
- __ j(not_equal, &next, Label::kNear);
+ bool compact = all_are_compact ? true :
+ CompactEmit(instr->hydrogen()->types(), name, i, isolate());
+ __ j(not_equal, &next, compact ? Label::kNear : Label::kFar);
__ bind(&check_passed);
EmitLoadFieldOrConstantFunction(
result, object, map, name, instr->environment());
- __ jmp(&done, compact_code ? Label::kNear: Label::kFar);
+ __ jmp(&done, all_are_compact ? Label::kNear : Label::kFar);
__ bind(&next);
}
}
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | test/mjsunit/regress/regress-deep-proto.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698