Skip to content

Commit 407657b

Browse files
conradwCommit bot
authored andcommitted
Revert of [strong] Implement strong mode restrictions on property access (patchset v8#23 id:460001 of https://codereview.chromium.org/1168093002/)
Reason for revert: Speculative revert, maybe breaks GC-stress http://build.chromium.org/p/client.v8/builders/V8%20Linux64%20GC%20Stress%20-%20custom%20snapshot/builds/808 Original issue's description: > [strong] Implement strong mode restrictions on property access > > Implements the strong mode proposal's restrictions on property access. > > To be fully explored in a followup: proxies, interceptors, access checks, load from super > > BUG=v8:3956 > LOG=N > > Committed: https://crrev.com/85dbfb9a389e7b21bd2a63862202ee97fc5d7982 > Cr-Commit-Position: refs/heads/master@{#29109} TBR=rossberg@chromium.org,mvstanton@chromium.org,mstarzinger@chromium.org,verwaest@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=v8:3956 Review URL: https://codereview.chromium.org/1189153002 Cr-Commit-Position: refs/heads/master@{#29115}
1 parent 5a4b156 commit 407657b

82 files changed

Lines changed: 624 additions & 2163 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/arm/code-stubs-arm.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4372,7 +4372,7 @@ void LoadICTrampolineStub::Generate(MacroAssembler* masm) {
43724372

43734373
void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) {
43744374
EmitLoadTypeFeedbackVector(masm, LoadWithVectorDescriptor::VectorRegister());
4375-
KeyedLoadICStub stub(isolate(), state());
4375+
KeyedLoadICStub stub(isolate());
43764376
stub.GenerateForTrampoline(masm);
43774377
}
43784378

@@ -4582,7 +4582,7 @@ void KeyedLoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) {
45824582
__ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex);
45834583
__ b(ne, &try_poly_name);
45844584
Handle<Code> megamorphic_stub =
4585-
KeyedLoadIC::ChooseMegamorphicStub(masm->isolate(), GetExtraICState());
4585+
KeyedLoadIC::ChooseMegamorphicStub(masm->isolate());
45864586
__ Jump(megamorphic_stub, RelocInfo::CODE_TARGET);
45874587

45884588
__ bind(&try_poly_name);

src/arm/full-codegen-arm.cc

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,7 +2242,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
22422242
__ ldr(load_name, MemOperand(sp, 2 * kPointerSize));
22432243
__ mov(LoadDescriptor::SlotRegister(),
22442244
Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot())));
2245-
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code();
2245+
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
22462246
CallIC(ic, TypeFeedbackId::None());
22472247
__ mov(r1, r0);
22482248
__ str(r1, MemOperand(sp, 2 * kPointerSize));
@@ -2423,7 +2423,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
24232423
__ mov(LoadDescriptor::NameRegister(), Operand(key->value()));
24242424
__ mov(LoadDescriptor::SlotRegister(),
24252425
Operand(SmiFromSlot(prop->PropertyFeedbackSlot())));
2426-
CallLoadIC(NOT_CONTEXTUAL, language_mode());
2426+
CallLoadIC(NOT_CONTEXTUAL);
24272427
}
24282428

24292429

@@ -2435,14 +2435,13 @@ void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) {
24352435
DCHECK(prop->IsSuperAccess());
24362436

24372437
__ Push(key->value());
2438-
__ Push(Smi::FromInt(language_mode()));
2439-
__ CallRuntime(Runtime::kLoadFromSuper, 4);
2438+
__ CallRuntime(Runtime::kLoadFromSuper, 3);
24402439
}
24412440

24422441

24432442
void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
24442443
SetSourcePosition(prop->position());
2445-
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code();
2444+
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
24462445
__ mov(LoadDescriptor::SlotRegister(),
24472446
Operand(SmiFromSlot(prop->PropertyFeedbackSlot())));
24482447
CallIC(ic);
@@ -2451,10 +2450,9 @@ void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
24512450

24522451
void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) {
24532452
// Stack: receiver, home_object, key.
2454-
__ Push(Smi::FromInt(language_mode()));
24552453
SetSourcePosition(prop->position());
24562454

2457-
__ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
2455+
__ CallRuntime(Runtime::kLoadKeyedFromSuper, 3);
24582456
}
24592457

24602458

@@ -3000,16 +2998,14 @@ void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) {
30002998
__ ldr(scratch, MemOperand(sp, kPointerSize * 2));
30012999
__ Push(scratch);
30023000
__ Push(key->value());
3003-
__ Push(Smi::FromInt(language_mode()));
30043001

30053002
// Stack here:
30063003
// - home_object
30073004
// - this (receiver)
30083005
// - this (receiver) <-- LoadFromSuper will pop here and below.
30093006
// - home_object
30103007
// - key
3011-
// - language_mode
3012-
__ CallRuntime(Runtime::kLoadFromSuper, 4);
3008+
__ CallRuntime(Runtime::kLoadFromSuper, 3);
30133009

30143010
// Replace home_object with target function.
30153011
__ str(r0, MemOperand(sp, kPointerSize));
@@ -3062,16 +3058,14 @@ void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) {
30623058
__ ldr(scratch, MemOperand(sp, kPointerSize * 2));
30633059
__ Push(scratch);
30643060
VisitForStackValue(prop->key());
3065-
__ Push(Smi::FromInt(language_mode()));
30663061

30673062
// Stack here:
30683063
// - home_object
30693064
// - this (receiver)
30703065
// - this (receiver) <-- LoadKeyedFromSuper will pop here and below.
30713066
// - home_object
30723067
// - key
3073-
// - language_mode
3074-
__ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
3068+
__ CallRuntime(Runtime::kLoadKeyedFromSuper, 3);
30753069

30763070
// Replace home_object with target function.
30773071
__ str(r0, MemOperand(sp, kPointerSize));

src/arm/lithium-codegen-arm.cc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2952,7 +2952,7 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
29522952
__ mov(LoadDescriptor::NameRegister(), Operand(instr->name()));
29532953
EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
29542954
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
2955-
Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, SLOPPY,
2955+
Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode,
29562956
PREMONOMORPHIC).code();
29572957
CallCode(ic, RelocInfo::CODE_TARGET, instr);
29582958
}
@@ -3048,10 +3048,9 @@ void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
30483048
// Name is always in r2.
30493049
__ mov(LoadDescriptor::NameRegister(), Operand(instr->name()));
30503050
EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
3051-
Handle<Code> ic =
3052-
CodeFactory::LoadICInOptimizedCode(
3053-
isolate(), NOT_CONTEXTUAL, instr->hydrogen()->language_mode(),
3054-
instr->hydrogen()->initialization_state()).code();
3051+
Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(
3052+
isolate(), NOT_CONTEXTUAL,
3053+
instr->hydrogen()->initialization_state()).code();
30553054
CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
30563055
}
30573056

@@ -3358,9 +3357,9 @@ void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
33583357
EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
33593358
}
33603359

3361-
Handle<Code> ic = CodeFactory::KeyedLoadICInOptimizedCode(
3362-
isolate(), instr->hydrogen()->language_mode(),
3363-
instr->hydrogen()->initialization_state()).code();
3360+
Handle<Code> ic =
3361+
CodeFactory::KeyedLoadICInOptimizedCode(
3362+
isolate(), instr->hydrogen()->initialization_state()).code();
33643363
CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
33653364
}
33663365

src/arm64/code-stubs-arm64.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4508,7 +4508,7 @@ void LoadICTrampolineStub::Generate(MacroAssembler* masm) {
45084508

45094509
void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) {
45104510
EmitLoadTypeFeedbackVector(masm, LoadWithVectorDescriptor::VectorRegister());
4511-
KeyedLoadICStub stub(isolate(), state());
4511+
KeyedLoadICStub stub(isolate());
45124512
stub.GenerateForTrampoline(masm);
45134513
}
45144514

@@ -4717,7 +4717,7 @@ void KeyedLoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) {
47174717
__ JumpIfNotRoot(feedback, Heap::kmegamorphic_symbolRootIndex,
47184718
&try_poly_name);
47194719
Handle<Code> megamorphic_stub =
4720-
KeyedLoadIC::ChooseMegamorphicStub(masm->isolate(), GetExtraICState());
4720+
KeyedLoadIC::ChooseMegamorphicStub(masm->isolate());
47214721
__ Jump(megamorphic_stub, RelocInfo::CODE_TARGET);
47224722

47234723
__ Bind(&try_poly_name);

src/arm64/full-codegen-arm64.cc

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,7 +2091,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
20912091
__ Mov(LoadDescriptor::NameRegister(), Operand(key->value()));
20922092
__ Mov(LoadDescriptor::SlotRegister(),
20932093
SmiFromSlot(prop->PropertyFeedbackSlot()));
2094-
CallLoadIC(NOT_CONTEXTUAL, language_mode());
2094+
CallLoadIC(NOT_CONTEXTUAL);
20952095
}
20962096

20972097

@@ -2103,15 +2103,14 @@ void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) {
21032103
DCHECK(prop->IsSuperAccess());
21042104

21052105
__ Push(key->value());
2106-
__ Push(Smi::FromInt(language_mode()));
2107-
__ CallRuntime(Runtime::kLoadFromSuper, 4);
2106+
__ CallRuntime(Runtime::kLoadFromSuper, 3);
21082107
}
21092108

21102109

21112110
void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
21122111
SetSourcePosition(prop->position());
21132112
// Call keyed load IC. It has arguments key and receiver in x0 and x1.
2114-
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code();
2113+
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
21152114
__ Mov(LoadDescriptor::SlotRegister(),
21162115
SmiFromSlot(prop->PropertyFeedbackSlot()));
21172116
CallIC(ic);
@@ -2120,10 +2119,9 @@ void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
21202119

21212120
void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) {
21222121
// Stack: receiver, home_object, key.
2123-
__ Push(Smi::FromInt(language_mode()));
21242122
SetSourcePosition(prop->position());
21252123

2126-
__ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
2124+
__ CallRuntime(Runtime::kLoadKeyedFromSuper, 3);
21272125
}
21282126

21292127

@@ -2685,15 +2683,14 @@ void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) {
26852683
__ Peek(scratch, kPointerSize);
26862684
__ Push(x0, scratch);
26872685
__ Push(key->value());
2688-
__ Push(Smi::FromInt(language_mode()));
26892686

26902687
// Stack here:
26912688
// - home_object
26922689
// - this (receiver)
26932690
// - this (receiver) <-- LoadFromSuper will pop here and below.
26942691
// - home_object
2695-
// - language_mode
2696-
__ CallRuntime(Runtime::kLoadFromSuper, 4);
2692+
// - key
2693+
__ CallRuntime(Runtime::kLoadFromSuper, 3);
26972694

26982695
// Replace home_object with target function.
26992696
__ Poke(x0, kPointerSize);
@@ -2746,16 +2743,14 @@ void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) {
27462743
__ Peek(scratch, kPointerSize);
27472744
__ Push(x0, scratch);
27482745
VisitForStackValue(prop->key());
2749-
__ Push(Smi::FromInt(language_mode()));
27502746

27512747
// Stack here:
27522748
// - home_object
27532749
// - this (receiver)
27542750
// - this (receiver) <-- LoadKeyedFromSuper will pop here and below.
27552751
// - home_object
27562752
// - key
2757-
// - language_mode
2758-
__ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
2753+
__ CallRuntime(Runtime::kLoadKeyedFromSuper, 3);
27592754

27602755
// Replace home_object with target function.
27612756
__ Poke(x0, kPointerSize);
@@ -5203,7 +5198,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
52035198
__ Peek(load_name, 2 * kPointerSize);
52045199
__ Mov(LoadDescriptor::SlotRegister(),
52055200
SmiFromSlot(expr->KeyedLoadFeedbackSlot()));
5206-
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code();
5201+
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
52075202
CallIC(ic, TypeFeedbackId::None());
52085203
__ Mov(x1, x0);
52095204
__ Poke(x1, 2 * kPointerSize);

src/arm64/lithium-codegen-arm64.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3306,7 +3306,7 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
33063306
__ Mov(LoadDescriptor::NameRegister(), Operand(instr->name()));
33073307
EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
33083308
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
3309-
Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, SLOPPY,
3309+
Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode,
33103310
PREMONOMORPHIC).code();
33113311
CallCode(ic, RelocInfo::CODE_TARGET, instr);
33123312
}
@@ -3576,9 +3576,9 @@ void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
35763576
EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
35773577
}
35783578

3579-
Handle<Code> ic = CodeFactory::KeyedLoadICInOptimizedCode(
3580-
isolate(), instr->hydrogen()->language_mode(),
3581-
instr->hydrogen()->initialization_state()).code();
3579+
Handle<Code> ic =
3580+
CodeFactory::KeyedLoadICInOptimizedCode(
3581+
isolate(), instr->hydrogen()->initialization_state()).code();
35823582
CallCode(ic, RelocInfo::CODE_TARGET, instr);
35833583

35843584
DCHECK(ToRegister(instr->result()).Is(x0));
@@ -3632,10 +3632,10 @@ void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
36323632
DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister()));
36333633
__ Mov(LoadDescriptor::NameRegister(), Operand(instr->name()));
36343634
EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
3635-
Handle<Code> ic =
3636-
CodeFactory::LoadICInOptimizedCode(
3637-
isolate(), NOT_CONTEXTUAL, instr->hydrogen()->language_mode(),
3638-
instr->hydrogen()->initialization_state()).code();
3635+
3636+
Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(
3637+
isolate(), NOT_CONTEXTUAL,
3638+
instr->hydrogen()->initialization_state()).code();
36393639
CallCode(ic, RelocInfo::CODE_TARGET, instr);
36403640

36413641
DCHECK(ToRegister(instr->result()).is(x0));

src/builtins.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,12 +1278,17 @@ static void Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) {
12781278

12791279

12801280
static void Generate_LoadIC_Slow(MacroAssembler* masm) {
1281-
NamedLoadHandlerCompiler::GenerateSlow(masm);
1281+
LoadIC::GenerateRuntimeGetProperty(masm);
1282+
}
1283+
1284+
1285+
static void Generate_KeyedLoadIC_Initialize(MacroAssembler* masm) {
1286+
KeyedLoadIC::GenerateInitialize(masm);
12821287
}
12831288

12841289

12851290
static void Generate_KeyedLoadIC_Slow(MacroAssembler* masm) {
1286-
ElementHandlerCompiler::GenerateLoadSlow(masm);
1291+
KeyedLoadIC::GenerateRuntimeGetProperty(masm);
12871292
}
12881293

12891294

@@ -1293,12 +1298,7 @@ static void Generate_KeyedLoadIC_Miss(MacroAssembler* masm) {
12931298

12941299

12951300
static void Generate_KeyedLoadIC_Megamorphic(MacroAssembler* masm) {
1296-
KeyedLoadIC::GenerateMegamorphic(masm, SLOPPY);
1297-
}
1298-
1299-
1300-
static void Generate_KeyedLoadIC_Megamorphic_Strong(MacroAssembler* masm) {
1301-
KeyedLoadIC::GenerateMegamorphic(masm, STRONG);
1301+
KeyedLoadIC::GenerateMegamorphic(masm);
13021302
}
13031303

13041304

src/builtins.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,9 @@ enum BuiltinExtraArguments {
8686
V(StoreIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
8787
V(KeyedStoreIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
8888
V(LoadIC_Getter_ForDeopt, LOAD_IC, MONOMORPHIC, kNoExtraICState) \
89+
V(KeyedLoadIC_Initialize, KEYED_LOAD_IC, UNINITIALIZED, kNoExtraICState) \
8990
V(KeyedLoadIC_Megamorphic, KEYED_LOAD_IC, MEGAMORPHIC, kNoExtraICState) \
9091
\
91-
V(KeyedLoadIC_Megamorphic_Strong, KEYED_LOAD_IC, MEGAMORPHIC, \
92-
LoadICState::kStrongModeState) \
93-
\
9492
V(StoreIC_Setter_ForDeopt, STORE_IC, MONOMORPHIC, \
9593
StoreICState::kStrictModeState) \
9694
\
@@ -106,6 +104,7 @@ enum BuiltinExtraArguments {
106104
V(KeyedStoreIC_Megamorphic_Strict, KEYED_STORE_IC, MEGAMORPHIC, \
107105
StoreICState::kStrictModeState) \
108106
\
107+
/* Uses KeyedLoadIC_Initialize; must be after in list. */ \
109108
V(FunctionCall, BUILTIN, UNINITIALIZED, kNoExtraICState) \
110109
V(FunctionApply, BUILTIN, UNINITIALIZED, kNoExtraICState) \
111110
V(ReflectApply, BUILTIN, UNINITIALIZED, kNoExtraICState) \
@@ -127,13 +126,13 @@ enum BuiltinExtraArguments {
127126
CODE_AGE_LIST_WITH_ARG(DECLARE_CODE_AGE_BUILTIN, V)
128127

129128
// Define list of builtin handlers implemented in assembly.
130-
#define BUILTIN_LIST_H(V) \
131-
V(LoadIC_Slow, LOAD_IC) \
132-
V(KeyedLoadIC_Slow, KEYED_LOAD_IC) \
133-
V(StoreIC_Slow, STORE_IC) \
134-
V(KeyedStoreIC_Slow, KEYED_STORE_IC) \
135-
V(LoadIC_Normal, LOAD_IC) \
136-
V(StoreIC_Normal, STORE_IC)
129+
#define BUILTIN_LIST_H(V) \
130+
V(LoadIC_Slow, LOAD_IC) \
131+
V(KeyedLoadIC_Slow, KEYED_LOAD_IC) \
132+
V(StoreIC_Slow, STORE_IC) \
133+
V(KeyedStoreIC_Slow, KEYED_STORE_IC) \
134+
V(LoadIC_Normal, LOAD_IC) \
135+
V(StoreIC_Normal, STORE_IC)
137136

138137
// Define list of builtins used by the debugger implemented in assembly.
139138
#define BUILTIN_LIST_DEBUG_A(V) \

0 commit comments

Comments
 (0)