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

Unified Diff: src/code-stubs-hydrogen.cc

Issue 1475823003: [runtime] First step to sanitize regexp literal creation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/code-stubs.cc ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index aa3f50ddca174d6051bc089eb615b4b8728c3b09..2a992e00e85592eb1ba7f189f890823fd3095019 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -433,6 +433,62 @@ Handle<Code> TypeofStub::GenerateCode() { return DoGenerateCode(this); }
template <>
+HValue* CodeStubGraphBuilder<FastCloneRegExpStub>::BuildCodeStub() {
+ HValue* closure = GetParameter(0);
+ HValue* literal_index = GetParameter(1);
+
+ // This stub is very performance sensitive, the generated code must be tuned
+ // so that it doesn't build and eager frame.
Yang 2015/11/25 09:06:10 Haha! Found typo "build an eager frame" :)
+ info()->MarkMustNotHaveEagerFrame();
+
+ HValue* literals_array = Add<HLoadNamedField>(
+ closure, nullptr, HObjectAccess::ForLiteralsPointer());
+ HInstruction* boilerplate = Add<HLoadKeyed>(
+ literals_array, literal_index, nullptr, FAST_ELEMENTS, NEVER_RETURN_HOLE,
+ LiteralsArray::kOffsetToFirstLiteral - kHeapObjectTag);
+
+ IfBuilder if_notundefined(this);
+ if_notundefined.IfNot<HCompareObjectEqAndBranch>(
+ boilerplate, graph()->GetConstantUndefined());
+ if_notundefined.Then();
+ {
+ int result_size =
+ JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize;
+ HValue* result =
+ Add<HAllocate>(Add<HConstant>(result_size), HType::JSObject(),
+ NOT_TENURED, JS_REGEXP_TYPE);
+ Add<HStoreNamedField>(
+ result, HObjectAccess::ForMap(),
+ Add<HLoadNamedField>(boilerplate, nullptr, HObjectAccess::ForMap()));
+ Add<HStoreNamedField>(
+ result, HObjectAccess::ForPropertiesPointer(),
+ Add<HLoadNamedField>(boilerplate, nullptr,
+ HObjectAccess::ForPropertiesPointer()));
+ Add<HStoreNamedField>(
+ result, HObjectAccess::ForElementsPointer(),
+ Add<HLoadNamedField>(boilerplate, nullptr,
+ HObjectAccess::ForElementsPointer()));
+ for (int offset = JSObject::kHeaderSize; offset < result_size;
+ offset += kPointerSize) {
+ HObjectAccess access = HObjectAccess::ForObservableJSObjectOffset(offset);
+ Add<HStoreNamedField>(result, access,
+ Add<HLoadNamedField>(boilerplate, nullptr, access));
+ }
+ Push(result);
+ }
+ if_notundefined.ElseDeopt(Deoptimizer::kUninitializedBoilerplateInFastClone);
+ if_notundefined.End();
+
+ return Pop();
+}
+
+
+Handle<Code> FastCloneRegExpStub::GenerateCode() {
+ return DoGenerateCode(this);
+}
+
+
+template <>
HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
Factory* factory = isolate()->factory();
HValue* undefined = graph()->GetConstantUndefined();
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698