2013-07-04 09:20:07 +00:00
|
|
|
// Copyright 2013 the V8 project authors. All rights reserved.
|
2014-04-29 06:42:26 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2013-07-04 09:20:07 +00:00
|
|
|
|
|
|
|
#ifndef V8_HYDROGEN_OSR_H_
|
|
|
|
#define V8_HYDROGEN_OSR_H_
|
|
|
|
|
|
|
|
#include "hydrogen.h"
|
|
|
|
#include "ast.h"
|
|
|
|
#include "zone.h"
|
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
// Responsible for building graph parts related to OSR and otherwise
|
|
|
|
// setting up the graph to do an OSR compile.
|
|
|
|
class HOsrBuilder : public ZoneObject {
|
|
|
|
public:
|
|
|
|
explicit HOsrBuilder(HOptimizedGraphBuilder* builder)
|
2013-09-09 16:34:40 +00:00
|
|
|
: unoptimized_frame_slots_(0),
|
|
|
|
builder_(builder),
|
2013-07-04 09:20:07 +00:00
|
|
|
osr_entry_(NULL),
|
|
|
|
osr_loop_entry_(NULL),
|
|
|
|
osr_values_(NULL) { }
|
2013-09-27 13:38:04 +00:00
|
|
|
|
2013-07-04 09:20:07 +00:00
|
|
|
// Creates the loop entry block for the given statement, setting up OSR
|
|
|
|
// entries as necessary, and sets the current block to the new block.
|
2013-09-27 13:38:04 +00:00
|
|
|
HBasicBlock* BuildOsrLoopEntry(IterationStatement* statement);
|
2013-07-04 09:20:07 +00:00
|
|
|
|
|
|
|
// Process the hydrogen graph after it has been completed, performing
|
|
|
|
// any OSR-specific cleanups or changes.
|
|
|
|
void FinishGraph();
|
|
|
|
|
|
|
|
// Process the OSR values and phis after initial graph optimization.
|
|
|
|
void FinishOsrValues();
|
|
|
|
|
2013-09-09 16:34:40 +00:00
|
|
|
// Return the number of slots in the unoptimized frame at the entry to OSR.
|
|
|
|
int UnoptimizedFrameSlots() const {
|
|
|
|
return unoptimized_frame_slots_;
|
|
|
|
}
|
|
|
|
|
2013-07-04 09:20:07 +00:00
|
|
|
bool HasOsrEntryAt(IterationStatement* statement);
|
|
|
|
|
2013-09-27 13:38:04 +00:00
|
|
|
private:
|
2013-09-09 16:34:40 +00:00
|
|
|
int unoptimized_frame_slots_;
|
2013-07-04 09:20:07 +00:00
|
|
|
HOptimizedGraphBuilder* builder_;
|
|
|
|
HBasicBlock* osr_entry_;
|
|
|
|
HBasicBlock* osr_loop_entry_;
|
|
|
|
ZoneList<HUnknownOSRValue*>* osr_values_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} } // namespace v8::internal
|
|
|
|
|
|
|
|
#endif // V8_HYDROGEN_OSR_H_
|