Remove strong mode support from materialized literals.
R=bmeurer@chromium.org BUG=v8:3956 LOG=n Review URL: https://codereview.chromium.org/1734243004 Cr-Commit-Position: refs/heads/master@{#34333}
This commit is contained in:
parent
567e58390d
commit
239ed8ffa8
@ -1337,14 +1337,11 @@ class MaterializedLiteral : public Expression {
|
||||
return depth_;
|
||||
}
|
||||
|
||||
bool is_strong() const { return is_strong_; }
|
||||
|
||||
protected:
|
||||
MaterializedLiteral(Zone* zone, int literal_index, bool is_strong, int pos)
|
||||
MaterializedLiteral(Zone* zone, int literal_index, int pos)
|
||||
: Expression(zone, pos),
|
||||
literal_index_(literal_index),
|
||||
is_simple_(false),
|
||||
is_strong_(is_strong),
|
||||
depth_(0) {}
|
||||
|
||||
// A materialized literal is simple if the values consist of only
|
||||
@ -1373,7 +1370,6 @@ class MaterializedLiteral : public Expression {
|
||||
private:
|
||||
int literal_index_;
|
||||
bool is_simple_;
|
||||
bool is_strong_;
|
||||
int depth_;
|
||||
|
||||
friend class AstLiteralReindexer;
|
||||
@ -1488,9 +1484,6 @@ class ObjectLiteral final : public MaterializedLiteral {
|
||||
if (disable_mementos) {
|
||||
flags |= kDisableMementos;
|
||||
}
|
||||
if (is_strong()) {
|
||||
flags |= kIsStrong;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
@ -1499,8 +1492,7 @@ class ObjectLiteral final : public MaterializedLiteral {
|
||||
kFastElements = 1,
|
||||
kHasFunction = 1 << 1,
|
||||
kShallowProperties = 1 << 2,
|
||||
kDisableMementos = 1 << 3,
|
||||
kIsStrong = 1 << 4
|
||||
kDisableMementos = 1 << 3
|
||||
};
|
||||
|
||||
struct Accessors: public ZoneObject {
|
||||
@ -1532,9 +1524,8 @@ class ObjectLiteral final : public MaterializedLiteral {
|
||||
|
||||
protected:
|
||||
ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index,
|
||||
int boilerplate_properties, bool has_function, bool is_strong,
|
||||
int pos)
|
||||
: MaterializedLiteral(zone, literal_index, is_strong, pos),
|
||||
int boilerplate_properties, bool has_function, int pos)
|
||||
: MaterializedLiteral(zone, literal_index, pos),
|
||||
properties_(properties),
|
||||
boilerplate_properties_(boilerplate_properties),
|
||||
fast_elements_(false),
|
||||
@ -1587,8 +1578,8 @@ class RegExpLiteral final : public MaterializedLiteral {
|
||||
|
||||
protected:
|
||||
RegExpLiteral(Zone* zone, const AstRawString* pattern, int flags,
|
||||
int literal_index, bool is_strong, int pos)
|
||||
: MaterializedLiteral(zone, literal_index, is_strong, pos),
|
||||
int literal_index, int pos)
|
||||
: MaterializedLiteral(zone, literal_index, pos),
|
||||
pattern_(pattern),
|
||||
flags_(flags) {
|
||||
set_depth(1);
|
||||
@ -1633,9 +1624,6 @@ class ArrayLiteral final : public MaterializedLiteral {
|
||||
if (disable_mementos) {
|
||||
flags |= kDisableMementos;
|
||||
}
|
||||
if (is_strong()) {
|
||||
flags |= kIsStrong;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
@ -1655,8 +1643,7 @@ class ArrayLiteral final : public MaterializedLiteral {
|
||||
enum Flags {
|
||||
kNoFlags = 0,
|
||||
kShallowElements = 1,
|
||||
kDisableMementos = 1 << 1,
|
||||
kIsStrong = 1 << 2
|
||||
kDisableMementos = 1 << 1
|
||||
};
|
||||
|
||||
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
|
||||
@ -1665,9 +1652,8 @@ class ArrayLiteral final : public MaterializedLiteral {
|
||||
|
||||
protected:
|
||||
ArrayLiteral(Zone* zone, ZoneList<Expression*>* values,
|
||||
int first_spread_index, int literal_index, bool is_strong,
|
||||
int pos)
|
||||
: MaterializedLiteral(zone, literal_index, is_strong, pos),
|
||||
int first_spread_index, int literal_index, int pos)
|
||||
: MaterializedLiteral(zone, literal_index, pos),
|
||||
values_(values),
|
||||
first_spread_index_(first_spread_index) {}
|
||||
static int parent_num_ids() { return MaterializedLiteral::num_ids(); }
|
||||
@ -3242,11 +3228,10 @@ class AstNodeFactory final BASE_EMBEDDED {
|
||||
int literal_index,
|
||||
int boilerplate_properties,
|
||||
bool has_function,
|
||||
bool is_strong,
|
||||
int pos) {
|
||||
return new (local_zone_)
|
||||
ObjectLiteral(local_zone_, properties, literal_index,
|
||||
boilerplate_properties, has_function, is_strong, pos);
|
||||
boilerplate_properties, has_function, pos);
|
||||
}
|
||||
|
||||
ObjectLiteral::Property* NewObjectLiteralProperty(
|
||||
@ -3265,24 +3250,23 @@ class AstNodeFactory final BASE_EMBEDDED {
|
||||
}
|
||||
|
||||
RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern, int flags,
|
||||
int literal_index, bool is_strong, int pos) {
|
||||
return new (local_zone_) RegExpLiteral(local_zone_, pattern, flags,
|
||||
literal_index, is_strong, pos);
|
||||
int literal_index, int pos) {
|
||||
return new (local_zone_)
|
||||
RegExpLiteral(local_zone_, pattern, flags, literal_index, pos);
|
||||
}
|
||||
|
||||
ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values,
|
||||
int literal_index,
|
||||
bool is_strong,
|
||||
int pos) {
|
||||
return new (local_zone_)
|
||||
ArrayLiteral(local_zone_, values, -1, literal_index, is_strong, pos);
|
||||
ArrayLiteral(local_zone_, values, -1, literal_index, pos);
|
||||
}
|
||||
|
||||
ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values,
|
||||
int first_spread_index, int literal_index,
|
||||
bool is_strong, int pos) {
|
||||
int pos) {
|
||||
return new (local_zone_) ArrayLiteral(
|
||||
local_zone_, values, first_spread_index, literal_index, is_strong, pos);
|
||||
local_zone_, values, first_spread_index, literal_index, pos);
|
||||
}
|
||||
|
||||
VariableProxy* NewVariableProxy(Variable* var,
|
||||
|
@ -649,7 +649,6 @@ void JSGenericLowering::LowerJSCreateLiteralArray(Node* node) {
|
||||
// Use the FastCloneShallowArrayStub only for shallow boilerplates up to the
|
||||
// initial length limit for arrays with "fast" elements kind.
|
||||
if ((p.flags() & ArrayLiteral::kShallowElements) != 0 &&
|
||||
(p.flags() & ArrayLiteral::kIsStrong) == 0 &&
|
||||
length < JSArray::kInitialMaxFastElementArray) {
|
||||
Callable callable = CodeFactory::FastCloneShallowArray(isolate());
|
||||
ReplaceWithStubCall(node, callable, flags);
|
||||
|
@ -6054,9 +6054,8 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
|
||||
Handle<Object> raw_boilerplate;
|
||||
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
|
||||
isolate(), raw_boilerplate,
|
||||
Runtime::CreateArrayLiteralBoilerplate(
|
||||
isolate(), literals, expr->constant_elements(),
|
||||
is_strong(function_language_mode())),
|
||||
Runtime::CreateArrayLiteralBoilerplate(isolate(), literals,
|
||||
expr->constant_elements()),
|
||||
Bailout(kArrayBoilerplateCreationFailed));
|
||||
|
||||
boilerplate_object = Handle<JSObject>::cast(raw_boilerplate);
|
||||
|
@ -158,8 +158,7 @@ bool FullCodeGenerator::MustCreateObjectLiteralWithRuntime(
|
||||
|
||||
bool FullCodeGenerator::MustCreateArrayLiteralWithRuntime(
|
||||
ArrayLiteral* expr) const {
|
||||
// TODO(rossberg): Teach strong mode to FastCloneShallowArrayStub.
|
||||
return expr->depth() > 1 || expr->is_strong() ||
|
||||
return expr->depth() > 1 ||
|
||||
expr->values()->length() > JSArray::kInitialMaxFastElementArray;
|
||||
}
|
||||
|
||||
|
@ -1218,8 +1218,7 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseRegExpLiteral(
|
||||
}
|
||||
int js_flags = flags.FromJust();
|
||||
Next();
|
||||
return factory()->NewRegExpLiteral(js_pattern, js_flags, literal_index,
|
||||
is_strong(language_mode()), pos);
|
||||
return factory()->NewRegExpLiteral(js_pattern, js_flags, literal_index, pos);
|
||||
}
|
||||
|
||||
|
||||
@ -1559,9 +1558,8 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseArrayLiteral(
|
||||
// Update the scope information before the pre-parsing bailout.
|
||||
int literal_index = function_state_->NextMaterializedLiteralIndex();
|
||||
|
||||
ExpressionT result =
|
||||
factory()->NewArrayLiteral(values, first_spread_index, literal_index,
|
||||
is_strong(language_mode()), pos);
|
||||
ExpressionT result = factory()->NewArrayLiteral(values, first_spread_index,
|
||||
literal_index, pos);
|
||||
if (first_spread_index >= 0) {
|
||||
result = factory()->NewRewritableExpression(result);
|
||||
Traits::QueueNonPatternForRewriting(result);
|
||||
@ -1877,7 +1875,6 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseObjectLiteral(
|
||||
literal_index,
|
||||
number_of_boilerplate_properties,
|
||||
has_function,
|
||||
is_strong(language_mode()),
|
||||
pos);
|
||||
}
|
||||
|
||||
|
@ -5327,12 +5327,11 @@ Expression* Parser::CloseTemplateLiteral(TemplateLiteralState* state, int start,
|
||||
ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(4, zone());
|
||||
args->Add(factory()->NewArrayLiteral(
|
||||
const_cast<ZoneList<Expression*>*>(cooked_strings),
|
||||
cooked_idx, is_strong(language_mode()), pos),
|
||||
cooked_idx, pos),
|
||||
zone());
|
||||
args->Add(
|
||||
factory()->NewArrayLiteral(
|
||||
const_cast<ZoneList<Expression*>*>(raw_strings), raw_idx,
|
||||
is_strong(language_mode()), pos),
|
||||
const_cast<ZoneList<Expression*>*>(raw_strings), raw_idx, pos),
|
||||
zone());
|
||||
|
||||
// Ensure hash is suitable as a Smi value
|
||||
@ -5421,7 +5420,6 @@ ZoneList<v8::internal::Expression*>* Parser::PrepareSpreadArguments(
|
||||
}
|
||||
int literal_index = function_state_->NextMaterializedLiteralIndex();
|
||||
args->Add(factory()->NewArrayLiteral(unspread, literal_index,
|
||||
is_strong(language_mode()),
|
||||
RelocInfo::kNoPosition),
|
||||
zone());
|
||||
|
||||
|
@ -488,8 +488,7 @@ void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node,
|
||||
empty_exprs,
|
||||
// Reuse pattern's literal index - it is unused since there is no
|
||||
// actual literal allocated.
|
||||
node->literal_index(), is_strong(scope()->language_mode()),
|
||||
RelocInfo::kNoPosition));
|
||||
node->literal_index(), RelocInfo::kNoPosition));
|
||||
|
||||
auto arguments = new (zone()) ZoneList<Expression*>(2, zone());
|
||||
arguments->Add(factory()->NewVariableProxy(array), zone());
|
||||
|
@ -424,18 +424,17 @@ class PreParserFactory {
|
||||
}
|
||||
PreParserExpression NewRegExpLiteral(PreParserIdentifier js_pattern,
|
||||
int js_flags, int literal_index,
|
||||
bool is_strong, int pos) {
|
||||
int pos) {
|
||||
return PreParserExpression::Default();
|
||||
}
|
||||
PreParserExpression NewArrayLiteral(PreParserExpressionList values,
|
||||
int literal_index,
|
||||
bool is_strong,
|
||||
int pos) {
|
||||
return PreParserExpression::ArrayLiteral();
|
||||
}
|
||||
PreParserExpression NewArrayLiteral(PreParserExpressionList values,
|
||||
int first_spread_index, int literal_index,
|
||||
bool is_strong, int pos) {
|
||||
int pos) {
|
||||
return PreParserExpression::ArrayLiteral();
|
||||
}
|
||||
PreParserExpression NewObjectLiteralProperty(PreParserExpression key,
|
||||
@ -455,7 +454,6 @@ class PreParserFactory {
|
||||
int literal_index,
|
||||
int boilerplate_properties,
|
||||
bool has_function,
|
||||
bool is_strong,
|
||||
int pos) {
|
||||
return PreParserExpression::ObjectLiteral();
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ namespace internal {
|
||||
|
||||
static Handle<Map> ComputeObjectLiteralMap(
|
||||
Handle<Context> context, Handle<FixedArray> constant_properties,
|
||||
bool is_strong, bool* is_result_from_cache) {
|
||||
bool* is_result_from_cache) {
|
||||
int properties_length = constant_properties->length();
|
||||
int number_of_properties = properties_length / 2;
|
||||
|
||||
@ -30,18 +30,17 @@ static Handle<Map> ComputeObjectLiteralMap(
|
||||
}
|
||||
Isolate* isolate = context->GetIsolate();
|
||||
return isolate->factory()->ObjectLiteralMapFromCache(
|
||||
context, number_of_properties, is_strong, is_result_from_cache);
|
||||
context, number_of_properties, false, is_result_from_cache);
|
||||
}
|
||||
|
||||
MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate(
|
||||
Isolate* isolate, Handle<LiteralsArray> literals,
|
||||
Handle<FixedArray> constant_properties, bool is_strong);
|
||||
|
||||
Handle<FixedArray> constant_properties);
|
||||
|
||||
MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate(
|
||||
Isolate* isolate, Handle<LiteralsArray> literals,
|
||||
Handle<FixedArray> constant_properties, bool should_have_fast_elements,
|
||||
bool has_function_literal, bool is_strong) {
|
||||
bool has_function_literal) {
|
||||
Handle<Context> context = isolate->native_context();
|
||||
|
||||
// In case we have function literals, we want the object to be in
|
||||
@ -50,11 +49,9 @@ MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate(
|
||||
// not the same (which is the common case).
|
||||
bool is_result_from_cache = false;
|
||||
Handle<Map> map = has_function_literal
|
||||
? Handle<Map>(is_strong
|
||||
? context->js_object_strong_map()
|
||||
: context->object_function()->initial_map())
|
||||
: ComputeObjectLiteralMap(context, constant_properties, is_strong,
|
||||
&is_result_from_cache);
|
||||
? Handle<Map>(context->object_function()->initial_map())
|
||||
: ComputeObjectLiteralMap(context, constant_properties,
|
||||
&is_result_from_cache);
|
||||
|
||||
PretenureFlag pretenure_flag =
|
||||
isolate->heap()->InNewSpace(*literals) ? NOT_TENURED : TENURED;
|
||||
@ -84,8 +81,7 @@ MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate(
|
||||
// simple object or array literal.
|
||||
Handle<FixedArray> array = Handle<FixedArray>::cast(value);
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate, value,
|
||||
CreateLiteralBoilerplate(isolate, literals, array, is_strong),
|
||||
isolate, value, CreateLiteralBoilerplate(isolate, literals, array),
|
||||
Object);
|
||||
}
|
||||
MaybeHandle<Object> maybe_result;
|
||||
@ -137,10 +133,9 @@ MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate(
|
||||
return boilerplate;
|
||||
}
|
||||
|
||||
|
||||
MaybeHandle<Object> Runtime::CreateArrayLiteralBoilerplate(
|
||||
Isolate* isolate, Handle<LiteralsArray> literals,
|
||||
Handle<FixedArray> elements, bool is_strong) {
|
||||
Handle<FixedArray> elements) {
|
||||
// Create the JSArray.
|
||||
Handle<JSFunction> constructor = isolate->array_function();
|
||||
|
||||
@ -159,9 +154,8 @@ MaybeHandle<Object> Runtime::CreateArrayLiteralBoilerplate(
|
||||
DisallowHeapAllocation no_gc;
|
||||
DCHECK(IsFastElementsKind(constant_elements_kind));
|
||||
Context* native_context = isolate->context()->native_context();
|
||||
Strength strength = is_strong ? Strength::STRONG : Strength::WEAK;
|
||||
Object* map = native_context->get(
|
||||
Context::ArrayMapIndex(constant_elements_kind, strength));
|
||||
Object* map =
|
||||
native_context->get(Context::ArrayMapIndex(constant_elements_kind));
|
||||
object->set_map(Map::cast(map));
|
||||
}
|
||||
|
||||
@ -196,8 +190,7 @@ MaybeHandle<Object> Runtime::CreateArrayLiteralBoilerplate(
|
||||
Handle<FixedArray> fa(FixedArray::cast(fixed_array_values->get(i)));
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
CreateLiteralBoilerplate(isolate, literals, fa, is_strong),
|
||||
isolate, result, CreateLiteralBoilerplate(isolate, literals, fa),
|
||||
Object);
|
||||
fixed_array_values_copy->set(i, *result);
|
||||
}
|
||||
@ -211,22 +204,21 @@ MaybeHandle<Object> Runtime::CreateArrayLiteralBoilerplate(
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate(
|
||||
Isolate* isolate, Handle<LiteralsArray> literals, Handle<FixedArray> array,
|
||||
bool is_strong) {
|
||||
Isolate* isolate, Handle<LiteralsArray> literals,
|
||||
Handle<FixedArray> array) {
|
||||
Handle<FixedArray> elements = CompileTimeValue::GetElements(array);
|
||||
const bool kHasNoFunctionLiteral = false;
|
||||
switch (CompileTimeValue::GetLiteralType(array)) {
|
||||
case CompileTimeValue::OBJECT_LITERAL_FAST_ELEMENTS:
|
||||
return CreateObjectLiteralBoilerplate(isolate, literals, elements, true,
|
||||
kHasNoFunctionLiteral, is_strong);
|
||||
kHasNoFunctionLiteral);
|
||||
case CompileTimeValue::OBJECT_LITERAL_SLOW_ELEMENTS:
|
||||
return CreateObjectLiteralBoilerplate(isolate, literals, elements, false,
|
||||
kHasNoFunctionLiteral, is_strong);
|
||||
kHasNoFunctionLiteral);
|
||||
case CompileTimeValue::ARRAY_LITERAL:
|
||||
return Runtime::CreateArrayLiteralBoilerplate(isolate, literals,
|
||||
elements, is_strong);
|
||||
elements);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return MaybeHandle<Object>();
|
||||
@ -264,7 +256,6 @@ RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) {
|
||||
bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0;
|
||||
bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0;
|
||||
bool enable_mementos = (flags & ObjectLiteral::kDisableMementos) == 0;
|
||||
bool is_strong = (flags & ObjectLiteral::kIsStrong) != 0;
|
||||
|
||||
RUNTIME_ASSERT(literals_index >= 0 &&
|
||||
literals_index < literals->literals_count());
|
||||
@ -279,7 +270,7 @@ RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) {
|
||||
isolate, raw_boilerplate,
|
||||
CreateObjectLiteralBoilerplate(isolate, literals, constant_properties,
|
||||
should_have_fast_elements,
|
||||
has_function_literal, is_strong));
|
||||
has_function_literal));
|
||||
boilerplate = Handle<JSObject>::cast(raw_boilerplate);
|
||||
|
||||
AllocationSiteCreationContext creation_context(isolate);
|
||||
@ -306,10 +297,9 @@ RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) {
|
||||
return *copy;
|
||||
}
|
||||
|
||||
|
||||
MUST_USE_RESULT static MaybeHandle<AllocationSite> GetLiteralAllocationSite(
|
||||
Isolate* isolate, Handle<LiteralsArray> literals, int literals_index,
|
||||
Handle<FixedArray> elements, bool is_strong) {
|
||||
Handle<FixedArray> elements) {
|
||||
// Check if boilerplate exists. If not, create it first.
|
||||
Handle<Object> literal_site(literals->literal(literals_index), isolate);
|
||||
Handle<AllocationSite> site;
|
||||
@ -318,8 +308,7 @@ MUST_USE_RESULT static MaybeHandle<AllocationSite> GetLiteralAllocationSite(
|
||||
Handle<Object> boilerplate;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate, boilerplate,
|
||||
Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements,
|
||||
is_strong),
|
||||
Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements),
|
||||
AllocationSite);
|
||||
|
||||
AllocationSiteCreationContext creation_context(isolate);
|
||||
@ -346,11 +335,9 @@ static MaybeHandle<JSObject> CreateArrayLiteralImpl(
|
||||
literals_index >= 0 && literals_index < literals->literals_count(),
|
||||
JSObject);
|
||||
Handle<AllocationSite> site;
|
||||
bool is_strong = (flags & ArrayLiteral::kIsStrong) != 0;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate, site,
|
||||
GetLiteralAllocationSite(isolate, literals, literals_index, elements,
|
||||
is_strong),
|
||||
GetLiteralAllocationSite(isolate, literals, literals_index, elements),
|
||||
JSObject);
|
||||
|
||||
bool enable_mementos = (flags & ArrayLiteral::kDisableMementos) == 0;
|
||||
|
@ -1143,7 +1143,7 @@ class Runtime : public AllStatic {
|
||||
// Used in runtime.cc and hydrogen's VisitArrayLiteral.
|
||||
MUST_USE_RESULT static MaybeHandle<Object> CreateArrayLiteralBoilerplate(
|
||||
Isolate* isolate, Handle<LiteralsArray> literals,
|
||||
Handle<FixedArray> elements, bool is_strong);
|
||||
Handle<FixedArray> elements);
|
||||
|
||||
static MaybeHandle<JSArray> GetInternalProperties(Isolate* isolate,
|
||||
Handle<Object>);
|
||||
|
@ -24454,30 +24454,6 @@ TEST(StrongModeArityCallFromApi2) {
|
||||
}
|
||||
|
||||
|
||||
TEST(StrongObjectDelete) {
|
||||
i::FLAG_strong_mode = true;
|
||||
LocalContext env;
|
||||
v8::Isolate* isolate = env->GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
Local<Object> obj;
|
||||
{
|
||||
v8::TryCatch try_catch(isolate);
|
||||
obj = Local<Object>::Cast(CompileRun(
|
||||
"'use strong';"
|
||||
"({});"));
|
||||
CHECK(!try_catch.HasCaught());
|
||||
}
|
||||
obj->DefineOwnProperty(env.local(), v8_str("foo"), v8_num(1), v8::None)
|
||||
.FromJust();
|
||||
obj->DefineOwnProperty(env.local(), v8_str("2"), v8_num(1), v8::None)
|
||||
.FromJust();
|
||||
CHECK(obj->HasOwnProperty(env.local(), v8_str("foo")).FromJust());
|
||||
CHECK(obj->HasOwnProperty(env.local(), v8_str("2")).FromJust());
|
||||
CHECK(!obj->Delete(env.local(), v8_str("foo")).FromJust());
|
||||
CHECK(!obj->Delete(env.local(), 2).FromJust());
|
||||
}
|
||||
|
||||
|
||||
static void ExtrasBindingTestRuntimeFunction(
|
||||
const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
CHECK_EQ(
|
||||
|
@ -1,11 +0,0 @@
|
||||
// Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --strong-mode
|
||||
|
||||
"use strong";
|
||||
|
||||
let o = {};
|
||||
Object.defineProperty(o, "foo", { writable: true });
|
||||
Object.defineProperty(o, "foo", { writable: false });
|
@ -1,9 +0,0 @@
|
||||
# Copyright 2015 the V8 project authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
*%(basename)s:11: TypeError: On strong object #<Object>, redefining writable, non-configurable property 'foo' to be non-writable is deprecated
|
||||
Object.defineProperty(o, "foo", { writable: false });
|
||||
^
|
||||
TypeError: On strong object #<Object>, redefining writable, non-configurable property 'foo' to be non-writable is deprecated
|
||||
at Function.defineProperty (native)
|
||||
at *%(basename)s:11:8
|
@ -1,9 +0,0 @@
|
||||
// Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --strong-mode
|
||||
|
||||
"use strong";
|
||||
|
||||
({}).__proto__ = {};
|
@ -1,9 +0,0 @@
|
||||
# Copyright 2015 the V8 project authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
*%(basename)s:9: TypeError: On strong object #<Object>, redefining the internal prototype is deprecated
|
||||
({}).__proto__ = {};
|
||||
^
|
||||
TypeError: On strong object #<Object>, redefining the internal prototype is deprecated
|
||||
at Object.set __proto__ (native)
|
||||
at *%(basename)s:9:16
|
@ -134,6 +134,9 @@
|
||||
'strong/load-property-mutate-backing-store': [SKIP],
|
||||
'strong/load-super': [SKIP],
|
||||
'strong/literals': [SKIP], # Rest arguments do not respect strongness in Turbofan.
|
||||
'strong/object-delete': [SKIP],
|
||||
'strong/object-freeze-property': [SKIP],
|
||||
'strong/object-set-prototype': [SKIP],
|
||||
|
||||
# Issue 4035: unexpected frame->context() in debugger
|
||||
'regress/regress-crbug-107996': [PASS, NO_VARIANTS],
|
||||
|
Loading…
Reference in New Issue
Block a user