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(); |