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

Unified Diff: src/objects-inl.h

Issue 112863002: Merge bleeding_edge 18021:18297 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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/objects.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 6e2ad06ea7fec2e829eb312740849ad207fbf6a6..1717a5f4b59a8cba4db473b0e0634e9c9c437b93 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1322,6 +1322,16 @@ void AllocationSite::Initialize() {
}
+void AllocationSite::MarkZombie() {
+ ASSERT(!IsZombie());
+ set_pretenure_decision(Smi::FromInt(kZombie));
+ // Clear all non-smi fields
+ set_transition_info(Smi::FromInt(0));
+ set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()),
+ SKIP_WRITE_BARRIER);
+}
+
+
// Heuristic: We only need to create allocation site info if the boilerplate
// elements kind is the initial elements kind.
AllocationSiteMode AllocationSite::GetMode(
@@ -1348,6 +1358,9 @@ AllocationSiteMode AllocationSite::GetMode(ElementsKind from,
inline bool AllocationSite::CanTrack(InstanceType type) {
+ if (FLAG_allocation_site_pretenuring) {
+ return type == JS_ARRAY_TYPE || type == JS_OBJECT_TYPE;
+ }
return type == JS_ARRAY_TYPE;
}
@@ -1367,6 +1380,45 @@ inline DependentCode::DependencyGroup AllocationSite::ToDependencyGroup(
}
+inline void AllocationSite::IncrementMementoFoundCount() {
+ int value = memento_found_count()->value();
+ set_memento_found_count(Smi::FromInt(value + 1));
+}
+
+
+inline void AllocationSite::IncrementMementoCreateCount() {
+ ASSERT(FLAG_allocation_site_pretenuring);
+ int value = memento_create_count()->value();
+ set_memento_create_count(Smi::FromInt(value + 1));
+}
+
+
+inline bool AllocationSite::DigestPretenuringFeedback() {
+ bool decision_made = false;
+ if (!PretenuringDecisionMade()) {
+ int create_count = memento_create_count()->value();
+ if (create_count >= kPretenureMinimumCreated) {
+ int found_count = memento_found_count()->value();
+ double ratio = static_cast<double>(found_count) / create_count;
+ if (FLAG_trace_track_allocation_sites) {
+ PrintF("AllocationSite: %p (created, found, ratio) (%d, %d, %f)\n",
+ static_cast<void*>(this), create_count, found_count, ratio);
+ }
+ int result = ratio >= kPretenureRatio ? kTenure : kDontTenure;
+ set_pretenure_decision(Smi::FromInt(result));
+ decision_made = true;
+ // TODO(mvstanton): if the decision represents a change, any dependent
+ // code registered for pretenuring changes should be deopted.
+ }
+ }
+
+ // Clear feedback calculation fields until the next gc.
+ set_memento_found_count(Smi::FromInt(0));
+ set_memento_create_count(Smi::FromInt(0));
+ return decision_made;
+}
+
+
void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) {
object->ValidateElements();
ElementsKind elements_kind = object->map()->elements_kind();
@@ -3837,14 +3889,14 @@ InlineCacheState Code::ic_state() {
}
-Code::ExtraICState Code::extra_ic_state() {
+ExtraICState Code::extra_ic_state() {
ASSERT((is_inline_cache_stub() && !needs_extended_extra_ic_state(kind()))
|| ic_state() == DEBUG_STUB);
return ExtractExtraICStateFromFlags(flags());
}
-Code::ExtraICState Code::extended_extra_ic_state() {
+ExtraICState Code::extended_extra_ic_state() {
ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB);
ASSERT(needs_extended_extra_ic_state(kind()));
return ExtractExtendedExtraICStateFromFlags(flags());
@@ -3907,19 +3959,6 @@ bool Code::has_major_key() {
}
-bool Code::is_pregenerated() {
- return (kind() == STUB && IsPregeneratedField::decode(flags()));
-}
-
-
-void Code::set_is_pregenerated(bool value) {
- ASSERT(kind() == STUB);
- Flags f = flags();
- f = static_cast<Flags>(IsPregeneratedField::update(f, value));
- set_flags(f);
-}
-
-
bool Code::optimizable() {
ASSERT_EQ(FUNCTION, kind());
return READ_BYTE_FIELD(this, kOptimizableOffset) == 1;
@@ -4181,12 +4220,12 @@ InlineCacheState Code::ExtractICStateFromFlags(Flags flags) {
}
-Code::ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) {
+ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) {
return ExtraICStateField::decode(flags);
}
-Code::ExtraICState Code::ExtractExtendedExtraICStateFromFlags(
+ExtraICState Code::ExtractExtendedExtraICStateFromFlags(
Flags flags) {
return ExtendedExtraICStateField::decode(flags);
}
« no previous file with comments | « src/objects.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698