Chromium Code Reviews| Index: src/code-stubs-hydrogen.cc |
| diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc |
| index f837045eed037a9235d5cdac317dd84dde883421..502597473f88e09c14c7849c458b8dcca6f414cc 100644 |
| --- a/src/code-stubs-hydrogen.cc |
| +++ b/src/code-stubs-hydrogen.cc |
| @@ -132,6 +132,61 @@ 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)); |
|
Jakob Kummerow
2013/02/08 12:45:49
nit: fits on last line
Michael Starzinger
2013/02/11 12:13:22
Done.
|
| + 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(); |