Index: src/code-stubs-hydrogen.cc |
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc |
index f837045eed037a9235d5cdac317dd84dde883421..bb570c6d85b92be50865a658ea0be63888d2fc3d 100644 |
--- a/src/code-stubs-hydrogen.cc |
+++ b/src/code-stubs-hydrogen.cc |
@@ -132,6 +132,60 @@ class CodeStubGraphBuilder: public CodeStubGraphBuilderBase { |
template <> |
+void CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { |
+ Zone* zone = this->zone(); |
+ Factory* factory = isolate()->factory(); |
+ |
+ HInstruction* boilerplate = |
+ AddInstruction(new(zone) HLoadKeyed(GetParameter(0), |
+ GetParameter(1), |
+ NULL, |
+ FAST_ELEMENTS)); |
+ |
+ CheckBuilder builder(this); |
+ builder.CheckNotUndefined(boilerplate); |
+ |
+ int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; |
+ HValue* boilerplate_size = |
+ AddInstruction(new(zone) HInstanceSize(boilerplate)); |
+ HValue* size_in_words = |
+ AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2, |
+ Representation::Integer32())); |
+ builder.CheckIntegerEq(boilerplate_size, size_in_words); |
+ |
+ HValue* size_in_bytes = |
+ AddInstruction(new(zone) HConstant(size, Representation::Integer32())); |
+ HInstruction* object = |
+ AddInstruction(new(zone) HAllocate(context(), |
+ size_in_bytes, |
+ HType::JSObject(), |
+ HAllocate::CAN_ALLOCATE_IN_NEW_SPACE)); |
+ |
+ for (int i = 0; i < size; i += kPointerSize) { |
+ HInstruction* value = |
+ AddInstruction(new(zone) HLoadNamedField(boilerplate, true, i)); |
+ AddInstruction(new(zone) HStoreNamedField(object, |
+ factory->empty_symbol(), |
+ value, |
+ true, i)); |
+ AddSimulate(BailoutId::StubEntry()); |
+ } |
+ |
+ builder.End(); |
+ |
+ HReturn* ret = new(zone) HReturn(object, context()); |
+ current_block()->Finish(ret); |
+} |
+ |
+ |
+Handle<Code> FastCloneShallowObjectStub::GenerateCode() { |
+ CodeStubGraphBuilder<FastCloneShallowObjectStub> builder(this); |
+ LChunk* chunk = OptimizeGraph(builder.CreateGraph()); |
+ return chunk->Codegen(Code::COMPILED_STUB); |
+} |
+ |
+ |
+template <> |
void CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() { |
Zone* zone = this->zone(); |