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

Unified Diff: src/objects-inl.h

Issue 409613002: Store both major and minor key on code stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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
« src/objects.h ('K') | « src/objects-debug.cc ('k') | src/stub-cache.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 10fa80394e285798d9608a69cd42fc7b8a093949..dff014e32168d2f041303538a644fe84cc75f441 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -4621,6 +4621,15 @@ Code::Kind Code::kind() {
}
+bool Code::IsCodeStubOrIC() {
+ return kind() == STUB || kind() == HANDLER || kind() == LOAD_IC ||
+ kind() == KEYED_LOAD_IC || kind() == CALL_IC || kind() == STORE_IC ||
+ kind() == KEYED_STORE_IC || kind() == BINARY_OP_IC ||
+ kind() == COMPARE_IC || kind() == COMPARE_NIL_IC ||
+ kind() == TO_BOOLEAN_IC;
+}
+
+
InlineCacheState Code::ic_state() {
InlineCacheState result = ExtractICStateFromFlags(flags());
// Only allow uninitialized or debugger states for non-IC code
@@ -4673,37 +4682,6 @@ inline void Code::set_is_crankshafted(bool value) {
}
-int Code::major_key() {
- ASSERT(has_major_key());
- return StubMajorKeyField::decode(
- READ_UINT32_FIELD(this, kKindSpecificFlags2Offset));
-}
-
-
-void Code::set_major_key(int major) {
- ASSERT(has_major_key());
- ASSERT(0 <= major && major < 256);
- int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
- int updated = StubMajorKeyField::update(previous, major);
- WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated);
-}
-
-
-bool Code::has_major_key() {
- return kind() == STUB ||
- kind() == HANDLER ||
- kind() == BINARY_OP_IC ||
- kind() == COMPARE_IC ||
- kind() == COMPARE_NIL_IC ||
- kind() == LOAD_IC ||
- kind() == KEYED_LOAD_IC ||
- kind() == STORE_IC ||
- kind() == CALL_IC ||
- kind() == KEYED_STORE_IC ||
- kind() == TO_BOOLEAN_IC;
-}
-
-
bool Code::optimizable() {
ASSERT_EQ(FUNCTION, kind());
return READ_BYTE_FIELD(this, kOptimizableOffset) == 1;
@@ -6129,7 +6107,7 @@ void Code::WipeOutHeader() {
WRITE_FIELD(this, kHandlerTableOffset, NULL);
WRITE_FIELD(this, kDeoptimizationDataOffset, NULL);
WRITE_FIELD(this, kConstantPoolOffset, NULL);
- // Do not wipe out e.g. a minor key.
+ // Do not wipe out major/minor keys on a code stub or IC
if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) {
WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL);
}
@@ -6150,24 +6128,15 @@ void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) {
}
-int Code::stub_info() {
- ASSERT(kind() == COMPARE_IC || kind() == COMPARE_NIL_IC ||
- kind() == BINARY_OP_IC || kind() == LOAD_IC || kind() == CALL_IC);
- return Smi::cast(raw_type_feedback_info())->value();
+uint32_t Code::stub_key() {
+ ASSERT(IsCodeStubOrIC());
+ return Smi::cast(raw_type_feedback_info())->value() - Smi::kMinValue;
}
-void Code::set_stub_info(int value) {
- ASSERT(kind() == COMPARE_IC ||
- kind() == COMPARE_NIL_IC ||
- kind() == BINARY_OP_IC ||
- kind() == STUB ||
- kind() == LOAD_IC ||
- kind() == CALL_IC ||
- kind() == KEYED_LOAD_IC ||
- kind() == STORE_IC ||
- kind() == KEYED_STORE_IC);
- set_raw_type_feedback_info(Smi::FromInt(value));
+void Code::set_stub_key(uint32_t key) {
+ ASSERT(IsCodeStubOrIC());
+ set_raw_type_feedback_info(Smi::FromInt(key + Smi::kMinValue));
}
« src/objects.h ('K') | « src/objects-debug.cc ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698