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

Unified Diff: src/code-stubs.h

Issue 1062163005: 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 424026f40b24b27390278541d7b35f341017548d..a363f8607b9f935fa954fb6240b553da52834064 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -1110,9 +1110,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));
}
@@ -1120,33 +1125,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()));
@@ -1157,9 +1164,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