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

Side by Side Diff: src/code-stubs.h

Issue 898723002: Use weak cell to embed property cell in StoreGlobal. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comment about weak cells in FindAndReplace Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_CODE_STUBS_H_ 5 #ifndef V8_CODE_STUBS_H_
6 #define V8_CODE_STUBS_H_ 6 #define V8_CODE_STUBS_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assembler.h" 9 #include "src/assembler.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 1077
1078 1078
1079 class StoreGlobalStub : public HandlerStub { 1079 class StoreGlobalStub : public HandlerStub {
1080 public: 1080 public:
1081 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) 1081 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global)
1082 : HandlerStub(isolate) { 1082 : HandlerStub(isolate) {
1083 set_sub_minor_key(IsConstantBits::encode(is_constant) | 1083 set_sub_minor_key(IsConstantBits::encode(is_constant) |
1084 CheckGlobalBits::encode(check_global)); 1084 CheckGlobalBits::encode(check_global));
1085 } 1085 }
1086 1086
1087 static Handle<HeapObject> global_placeholder(Isolate* isolate) { 1087 static Handle<HeapObject> property_cell_placeholder(Isolate* isolate) {
1088 return isolate->factory()->uninitialized_value(); 1088 return isolate->factory()->uninitialized_value();
1089 } 1089 }
1090 1090
1091 Handle<Code> GetCodeCopyFromTemplate(Handle<GlobalObject> global, 1091 Handle<Code> GetCodeCopyFromTemplate(Handle<GlobalObject> global,
1092 Handle<PropertyCell> cell) { 1092 Handle<PropertyCell> cell) {
1093 if (check_global()) { 1093 if (check_global()) {
1094 Code::FindAndReplacePattern pattern; 1094 Code::FindAndReplacePattern pattern;
1095 pattern.Add(isolate()->factory()->meta_map(), 1095 pattern.Add(isolate()->factory()->meta_map(),
1096 Map::WeakCellForMap(Handle<Map>(global->map()))); 1096 Map::WeakCellForMap(Handle<Map>(global->map())));
1097 pattern.Add(isolate()->factory()->global_property_cell_map(), cell); 1097 pattern.Add(Handle<Map>(property_cell_placeholder(isolate())->map()),
1098 isolate()->factory()->NewWeakCell(cell));
1098 return CodeStub::GetCodeCopy(pattern); 1099 return CodeStub::GetCodeCopy(pattern);
1099 } else { 1100 } else {
1100 Code::FindAndReplacePattern pattern; 1101 Code::FindAndReplacePattern pattern;
1101 pattern.Add(isolate()->factory()->global_property_cell_map(), cell); 1102 pattern.Add(Handle<Map>(property_cell_placeholder(isolate())->map()),
1103 isolate()->factory()->NewWeakCell(cell));
1102 return CodeStub::GetCodeCopy(pattern); 1104 return CodeStub::GetCodeCopy(pattern);
1103 } 1105 }
1104 } 1106 }
1105 1107
1106 Code::Kind kind() const OVERRIDE { return Code::STORE_IC; } 1108 Code::Kind kind() const OVERRIDE { return Code::STORE_IC; }
1107 1109
1108 bool is_constant() const { return IsConstantBits::decode(sub_minor_key()); } 1110 bool is_constant() const { return IsConstantBits::decode(sub_minor_key()); }
1109 1111
1110 bool check_global() const { return CheckGlobalBits::decode(sub_minor_key()); } 1112 bool check_global() const { return CheckGlobalBits::decode(sub_minor_key()); }
1111 1113
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after
2671 2673
2672 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR 2674 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR
2673 #undef DEFINE_PLATFORM_CODE_STUB 2675 #undef DEFINE_PLATFORM_CODE_STUB
2674 #undef DEFINE_HANDLER_CODE_STUB 2676 #undef DEFINE_HANDLER_CODE_STUB
2675 #undef DEFINE_HYDROGEN_CODE_STUB 2677 #undef DEFINE_HYDROGEN_CODE_STUB
2676 #undef DEFINE_CODE_STUB 2678 #undef DEFINE_CODE_STUB
2677 #undef DEFINE_CODE_STUB_BASE 2679 #undef DEFINE_CODE_STUB_BASE
2678 } } // namespace v8::internal 2680 } } // namespace v8::internal
2679 2681
2680 #endif // V8_CODE_STUBS_H_ 2682 #endif // V8_CODE_STUBS_H_
OLDNEW
« 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