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

Unified Diff: src/compiler/bytecode-graph-builder.cc

Issue 1683103002: [compiler] Sanitize entry points to LookupSlot access. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Fixes. Comments. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/bytecode-graph-builder.cc
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc
index 1bc2141a2078a535d1bcdb9c3a398b624e762140..c31043c5bb44f10ab25b05361ce349f94a6fae9f 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -492,15 +492,6 @@ Node* BytecodeGraphBuilder::GetFunctionClosure() {
}
-Node* BytecodeGraphBuilder::BuildLoadImmutableObjectField(Node* object,
- int offset) {
- return graph()->NewNode(jsgraph()->machine()->Load(MachineType::AnyTagged()),
- object,
- jsgraph()->IntPtrConstant(offset - kHeapObjectTag),
- graph()->start(), graph()->start());
-}
-
-
Node* BytecodeGraphBuilder::BuildLoadNativeContextField(int index) {
const Operator* op =
javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true);
@@ -509,19 +500,6 @@ Node* BytecodeGraphBuilder::BuildLoadNativeContextField(int index) {
}
-Node* BytecodeGraphBuilder::BuildLoadFeedbackVector() {
- if (!feedback_vector_.is_set()) {
- Node* closure = GetFunctionClosure();
- Node* shared = BuildLoadImmutableObjectField(
- closure, JSFunction::kSharedFunctionInfoOffset);
- Node* vector = BuildLoadImmutableObjectField(
- shared, SharedFunctionInfo::kFeedbackVectorOffset);
- feedback_vector_.set(vector);
- }
- return feedback_vector_.get();
-}
-
-
VectorSlotPair BytecodeGraphBuilder::CreateVectorSlotPair(int slot_id) {
Handle<TypeFeedbackVector> feedback_vector = info()->feedback_vector();
FeedbackVectorSlot slot;
@@ -761,11 +739,13 @@ void BytecodeGraphBuilder::VisitStaContextSlotWide() { VisitStaContextSlot(); }
void BytecodeGraphBuilder::BuildLdaLookupSlot(TypeofMode typeof_mode) {
FrameStateBeforeAndAfter states(this);
- Handle<String> name =
- Handle<String>::cast(bytecode_iterator().GetConstantForIndexOperand(0));
- const Operator* op = javascript()->LoadDynamic(name, typeof_mode);
- Node* value =
- NewNode(op, BuildLoadFeedbackVector(), environment()->Context());
+ Node* name =
+ jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0));
+ const Operator* op =
+ javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF
+ ? Runtime::kLoadLookupSlot
+ : Runtime::kLoadLookupSlotInsideTypeof);
+ Node* value = NewNode(op, name);
environment()->BindAccumulator(value, &states);
}
@@ -782,9 +762,10 @@ void BytecodeGraphBuilder::BuildStaLookupSlot(LanguageMode language_mode) {
Node* value = environment()->LookupAccumulator();
Node* name =
jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0));
- Node* language = jsgraph()->Constant(language_mode);
- const Operator* op = javascript()->CallRuntime(Runtime::kStoreLookupSlot);
- Node* store = NewNode(op, value, environment()->Context(), name, language);
+ const Operator* op = javascript()->CallRuntime(
+ is_strict(language_mode) ? Runtime::kStoreLookupSlot_Strict
+ : Runtime::kStoreLookupSlot_Sloppy);
+ Node* store = NewNode(op, name, value);
environment()->BindAccumulator(store, &states);
}
@@ -1328,7 +1309,7 @@ void BytecodeGraphBuilder::VisitDeleteLookupSlot() {
FrameStateBeforeAndAfter states(this);
Node* name = environment()->LookupAccumulator();
const Operator* op = javascript()->CallRuntime(Runtime::kDeleteLookupSlot);
- Node* result = NewNode(op, environment()->Context(), name);
+ Node* result = NewNode(op, name);
environment()->BindAccumulator(result, &states);
}
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698