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

Unified Diff: src/objects-inl.h

Issue 12385014: Hydrogen stubs for array constructors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: More efficient code when number of arguments is known Created 7 years, 8 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/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 5cde67d7e97e17560c8e22553a0909eb20f38532..a263012dec8a4e91b58b556dcc8ca2e0f123188b 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1297,6 +1297,44 @@ void JSObject::ValidateElements() {
}
+bool JSObject::ShouldTrackAllocationInfo() {
+ if (map()->CanTrackAllocationSite()) {
+ if (!IsJSArray()) {
+ return true;
+ }
+
+ return AllocationSiteInfo::GetMode(GetElementsKind()) ==
+ TRACK_ALLOCATION_SITE;
+ }
+ return false;
+}
+
+
+// Heuristic: We only need to create allocation site info if the boilerplate
+// elements kind is the initial elements kind.
+AllocationSiteMode AllocationSiteInfo::GetMode(
+ ElementsKind boilerplate_elements_kind) {
+ if (FLAG_track_allocation_sites &&
+ IsFastSmiElementsKind(boilerplate_elements_kind)) {
+ return TRACK_ALLOCATION_SITE;
+ }
+
+ return DONT_TRACK_ALLOCATION_SITE;
+}
+
+
+AllocationSiteMode AllocationSiteInfo::GetMode(ElementsKind from,
+ ElementsKind to) {
+ if (FLAG_track_allocation_sites &&
+ IsFastSmiElementsKind(from) &&
+ (IsFastObjectElementsKind(to) || IsFastDoubleElementsKind(to))) {
+ return TRACK_ALLOCATION_SITE;
+ }
+
+ return DONT_TRACK_ALLOCATION_SITE;
+}
+
+
MaybeObject* JSObject::EnsureCanContainHeapObjectElements() {
ValidateElements();
ElementsKind elements_kind = map()->elements_kind();
@@ -3671,12 +3709,13 @@ void Code::set_major_key(int major) {
bool Code::is_pregenerated() {
- return kind() == STUB && IsPregeneratedField::decode(flags());
+ return (kind() == STUB || kind() == COMPILED_STUB)
+ && IsPregeneratedField::decode(flags());
}
void Code::set_is_pregenerated(bool value) {
- ASSERT(kind() == STUB);
+ ASSERT(kind() == STUB || kind() == COMPILED_STUB);
Flags f = flags();
f = static_cast<Flags>(IsPregeneratedField::update(f, value));
set_flags(f);
« src/ia32/code-stubs-ia32.cc ('K') | « src/objects.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698