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

Unified Diff: src/hydrogen.cc

Issue 1168093002: [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix arm64 port Created 5 years, 6 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/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 810a8b92210d4bb2389d024490c65b0b88e22eb1..b63ee6e3966b030e1bdc5524e8db662fb93b729c 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -683,6 +683,11 @@ HConstant* HGraph::GetConstantMinus1() {
}
+HConstant* HGraph::GetConstantBool(bool value) {
+ return value ? GetConstantTrue() : GetConstantFalse();
+}
+
+
#define DEFINE_GET_CONSTANT(Name, name, type, htype, boolean_value) \
HConstant* HGraph::GetConstant##Name() { \
if (!constant_##name##_.is_set()) { \
@@ -1670,7 +1675,8 @@ HValue* HGraphBuilder::BuildElementIndexHash(HValue* index) {
HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver,
HValue* elements,
HValue* key,
- HValue* hash) {
+ HValue* hash,
+ Strength strength) {
HValue* capacity =
Add<HLoadKeyed>(elements, Add<HConstant>(NameDictionary::kCapacityIndex),
nullptr, FAST_ELEMENTS);
@@ -1712,10 +1718,11 @@ HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver,
{
// element == undefined means "not found". Call the runtime.
// TODO(jkummerow): walk the prototype chain instead.
- Add<HPushArguments>(receiver, key);
+ Add<HPushArguments>(receiver, key,
+ graph()->GetConstantBool(static_cast<bool>(strength)));
Push(Add<HCallRuntime>(isolate()->factory()->empty_string(),
Runtime::FunctionForId(Runtime::kKeyedGetProperty),
- 2));
+ 3));
}
if_undefined.Else();
{
@@ -1772,10 +1779,11 @@ HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver,
result_index->ClearFlag(HValue::kCanOverflow);
Push(Add<HLoadKeyed>(elements, result_index, nullptr, FAST_ELEMENTS));
details_compare.Else();
- Add<HPushArguments>(receiver, key);
+ Add<HPushArguments>(receiver, key,
+ graph()->GetConstantBool(static_cast<bool>(strength)));
Push(Add<HCallRuntime>(isolate()->factory()->empty_string(),
Runtime::FunctionForId(Runtime::kKeyedGetProperty),
- 2));
+ 3));
details_compare.End();
found_key_match.Else();
@@ -6220,7 +6228,7 @@ bool HOptimizedGraphBuilder::PropertyAccessInfo::CanAccessMonomorphic() {
if (IsFound()) return IsLoad() || !IsReadOnly();
if (IsIntegerIndexedExotic()) return false;
if (!LookupInPrototypes()) return false;
- if (IsLoad()) return true;
+ if (IsLoad()) return !is_strong(builder_->function_language_mode());
if (IsAccessorConstant()) return true;
LookupTransition(*map_, *name_, NONE);
@@ -7038,14 +7046,14 @@ HInstruction* HOptimizedGraphBuilder::BuildNamedGeneric(
// use a generic Keyed Load if we are using the type vector, because
// it has to share information with full code.
HConstant* key = Add<HConstant>(name);
- HLoadKeyedGeneric* result =
- New<HLoadKeyedGeneric>(object, key, PREMONOMORPHIC);
+ HLoadKeyedGeneric* result = New<HLoadKeyedGeneric>(
+ object, key, function_language_mode(), PREMONOMORPHIC);
result->SetVectorAndSlot(vector, slot);
return result;
}
- HLoadNamedGeneric* result =
- New<HLoadNamedGeneric>(object, name, PREMONOMORPHIC);
+ HLoadNamedGeneric* result = New<HLoadNamedGeneric>(
+ object, name, function_language_mode(), PREMONOMORPHIC);
result->SetVectorAndSlot(vector, slot);
return result;
} else {
@@ -7064,8 +7072,8 @@ HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric(
HValue* value) {
if (access_type == LOAD) {
InlineCacheState initial_state = expr->AsProperty()->GetInlineCacheState();
- HLoadKeyedGeneric* result =
- New<HLoadKeyedGeneric>(object, key, initial_state);
+ HLoadKeyedGeneric* result = New<HLoadKeyedGeneric>(
+ object, key, function_language_mode(), initial_state);
// HLoadKeyedGeneric with vector ics benefits from being encoded as
// MEGAMORPHIC because the vector/slot combo becomes unnecessary.
if (initial_state != MEGAMORPHIC) {
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | test/mjsunit/strong/load-element.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698