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

Unified Diff: src/objects-inl.h

Issue 12225099: Remove prototype checks for leaf maps in optimized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rename "dependent codes" and add comment. Created 7 years, 10 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 209c2ade04a077b1b340251f295bbfcbdd061e12..57182833ad733ad6a09fd085f0c4e1cd5ae761b8 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -584,7 +584,7 @@ bool Object::IsDeoptimizationOutputData() {
}
-bool Object::IsDependentCodes() {
+bool Object::IsDependentCode() {
if (!IsFixedArray()) return false;
// There's actually no way to see the difference between a fixed array and
// a dependent codes array.
@@ -2392,7 +2392,7 @@ CAST_ACCESSOR(FixedDoubleArray)
CAST_ACCESSOR(DescriptorArray)
CAST_ACCESSOR(DeoptimizationInputData)
CAST_ACCESSOR(DeoptimizationOutputData)
-CAST_ACCESSOR(DependentCodes)
+CAST_ACCESSOR(DependentCode)
CAST_ACCESSOR(TypeFeedbackCells)
CAST_ACCESSOR(SymbolTable)
CAST_ACCESSOR(JSFunctionResultCache)
@@ -3424,64 +3424,63 @@ bool Map::is_observed() {
return IsObserved::decode(bit_field3());
}
+void Map::NotifyObjectLayoutChange() {
+ DeoptimizeDependentCode(DependentCode::kPrototypeCheckGroup);
+}
+
+bool Map::CanOmitPrototypeChecks() {
+ return !HasTransitionArray() && !is_dictionary_map();
+}
-void Map::AddDependentCode(DependentCodes::DependencyGroup group,
+void Map::AddDependentCode(DependentCode::DependencyGroup group,
Handle<Code> code) {
- Handle<DependentCodes> codes =
- DependentCodes::Insert(Handle<DependentCodes>(dependent_codes()),
+ Handle<DependentCode> codes =
+ DependentCode::Insert(Handle<DependentCode>(dependent_code()),
group, code);
- if (*codes != dependent_codes()) {
- set_dependent_codes(*codes);
+ if (*codes != dependent_code()) {
+ set_dependent_code(*codes);
}
}
-int DependentCodes::number_of_codes(DependencyGroup group) {
+int DependentCode::number_of_codes(DependencyGroup group) {
if (length() == 0) return 0;
return Smi::cast(get(group))->value();
}
-void DependentCodes::set_number_of_codes(DependencyGroup group, int value) {
+void DependentCode::set_number_of_codes(DependencyGroup group, int value) {
set(group, Smi::FromInt(value));
}
-Code* DependentCodes::code_at(int i) {
+Code* DependentCode::code_at(int i) {
return Code::cast(get(kCodesStartIndex + i));
}
-void DependentCodes::set_code_at(int i, Code* value) {
+void DependentCode::set_code_at(int i, Code* value) {
set(kCodesStartIndex + i, value);
}
-Object** DependentCodes::code_slot_at(int i) {
+Object** DependentCode::code_slot_at(int i) {
return HeapObject::RawField(
this, FixedArray::OffsetOfElementAt(kCodesStartIndex + i));
}
-void DependentCodes::clear_code_at(int i) {
+void DependentCode::clear_code_at(int i) {
set_undefined(kCodesStartIndex + i);
}
-void DependentCodes::ComputeGroupStartIndexes(GroupStartIndexes starts) {
- starts[0] = 0;
- for (int g = 1; g <= kGroupCount; g++) {
- int count = number_of_codes(static_cast<DependencyGroup>(g - 1));
- starts[g] = starts[g - 1] + count;
- }
-}
-
-
-void DependentCodes::ExtendGroup(DependencyGroup group) {
- GroupStartIndexes starts;
- ComputeGroupStartIndexes(starts);
- for (int g = kGroupCount - 2; g > group; g--) {
- set_code_at(starts[g + 1], code_at(starts[g]));
+void DependentCode::ExtendGroup(DependencyGroup group) {
+ GroupStartIndexes starts(this);
+ for (int g = kGroupCount - 1; g > group; g--) {
+ if (starts.at(g) < starts.at(g + 1)) {
+ set_code_at(starts.at(g + 1), code_at(starts.at(g)));
+ }
}
}
@@ -4108,7 +4107,7 @@ HeapObject* Map::UncheckedPrototypeTransitions() {
ACCESSORS(Map, code_cache, Object, kCodeCacheOffset)
-ACCESSORS(Map, dependent_codes, DependentCodes, kDependentCodesOffset)
+ACCESSORS(Map, dependent_code, DependentCode, kDependentCodeOffset)
ACCESSORS(Map, constructor, Object, kConstructorOffset)
ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset)
« src/objects.h ('K') | « src/objects-debug.cc ('k') | src/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698