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

Unified Diff: src/code-stubs.h

Issue 1102543002: Reland: track global accesses to constant types (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index c40bc857cad53b1d03778940c7615c3cc67c2a38..6bfe8b5c21501800fcdcf92255d1d3a74b8bf4c7 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -1137,9 +1137,14 @@ class StoreTransitionStub : public HandlerStub {
class StoreGlobalStub : public HandlerStub {
public:
- StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global)
+ StoreGlobalStub(Isolate* isolate, PropertyCellType type,
+ Maybe<PropertyCellConstantType> constant_type,
+ bool check_global)
: HandlerStub(isolate) {
- set_sub_minor_key(IsConstantBits::encode(is_constant) |
+ PropertyCellConstantType encoded_constant_type =
+ constant_type.FromMaybe(PropertyCellConstantType::kSmi);
+ set_sub_minor_key(CellTypeBits::encode(type) |
+ ConstantTypeBits::encode(encoded_constant_type) |
CheckGlobalBits::encode(check_global));
}
@@ -1147,33 +1152,35 @@ class StoreGlobalStub : public HandlerStub {
return isolate->factory()->uninitialized_value();
}
+ static Handle<HeapObject> global_map_placeholder(Isolate* isolate) {
+ return isolate->factory()->termination_exception();
+ }
+
Handle<Code> GetCodeCopyFromTemplate(Handle<GlobalObject> global,
Handle<PropertyCell> cell) {
+ Code::FindAndReplacePattern pattern;
if (check_global()) {
- Code::FindAndReplacePattern pattern;
- pattern.Add(isolate()->factory()->meta_map(),
+ pattern.Add(handle(global_map_placeholder(isolate())->map()),
Map::WeakCellForMap(Handle<Map>(global->map())));
- pattern.Add(Handle<Map>(property_cell_placeholder(isolate())->map()),
- isolate()->factory()->NewWeakCell(cell));
- return CodeStub::GetCodeCopy(pattern);
- } else {
- Code::FindAndReplacePattern pattern;
- pattern.Add(Handle<Map>(property_cell_placeholder(isolate())->map()),
- isolate()->factory()->NewWeakCell(cell));
- return CodeStub::GetCodeCopy(pattern);
}
+ pattern.Add(handle(property_cell_placeholder(isolate())->map()),
+ isolate()->factory()->NewWeakCell(cell));
+ return CodeStub::GetCodeCopy(pattern);
}
Code::Kind kind() const override { return Code::STORE_IC; }
- bool is_constant() const { return IsConstantBits::decode(sub_minor_key()); }
-
- bool check_global() const { return CheckGlobalBits::decode(sub_minor_key()); }
+ PropertyCellType cell_type() const {
+ return CellTypeBits::decode(sub_minor_key());
+ }
- void set_is_constant(bool value) {
- set_sub_minor_key(IsConstantBits::update(sub_minor_key(), value));
+ PropertyCellConstantType constant_type() const {
+ DCHECK(PropertyCellType::kConstantType == cell_type());
+ return ConstantTypeBits::decode(sub_minor_key());
}
+ bool check_global() const { return CheckGlobalBits::decode(sub_minor_key()); }
+
Representation representation() {
return Representation::FromKind(
RepresentationBits::decode(sub_minor_key()));
@@ -1184,9 +1191,10 @@ class StoreGlobalStub : public HandlerStub {
}
private:
- class IsConstantBits: public BitField<bool, 0, 1> {};
- class RepresentationBits: public BitField<Representation::Kind, 1, 8> {};
- class CheckGlobalBits: public BitField<bool, 9, 1> {};
+ class CellTypeBits : public BitField<PropertyCellType, 0, 2> {};
+ class ConstantTypeBits : public BitField<PropertyCellConstantType, 2, 2> {};
+ class RepresentationBits : public BitField<Representation::Kind, 4, 8> {};
+ class CheckGlobalBits : public BitField<bool, 12, 1> {};
DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub);
};
« no previous file with comments | « no previous file | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698