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

Unified Diff: src/feedback_slots.h

Issue 137403009: Adding a type vector to replace type cells. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: PORTS. Created 6 years, 11 months 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
Index: src/feedback_slots.h
diff --git a/test/cctest/trace-extension.h b/src/feedback_slots.h
similarity index 50%
copy from test/cctest/trace-extension.h
copy to src/feedback_slots.h
index b80b3d45dc81579629ddccb6761cfa709b17e4e9..e85fa23454c7ae824e16fb9e657faf04a970684b 100644
--- a/test/cctest/trace-extension.h
+++ b/src/feedback_slots.h
@@ -25,32 +25,78 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef V8_TEST_CCTEST_TRACE_EXTENSION_H_
-#define V8_TEST_CCTEST_TRACE_EXTENSION_H_
+#ifndef V8_FEEDBACK_SLOTS_H_
+#define V8_FEEDBACK_SLOTS_H_
#include "v8.h"
+#include "isolate.h"
+
namespace v8 {
namespace internal {
-class TraceExtension : public v8::Extension {
+class FeedbackSlotInterface {
Benedikt Meurer 2014/02/04 08:53:50 Hm, do we really need a new header file for this i
mvstanton 2014/02/04 13:03:27 Since deferred slot processor is rather involved,
public:
- TraceExtension() : v8::Extension("v8/trace", kSource) { }
- virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate(
- v8::Isolate* isolate,
- v8::Handle<v8::String> name);
- static void Trace(const v8::FunctionCallbackInfo<v8::Value>& args);
- static void JSTrace(const v8::FunctionCallbackInfo<v8::Value>& args);
- static void JSEntrySP(const v8::FunctionCallbackInfo<v8::Value>& args);
- static void JSEntrySPLevel2(const v8::FunctionCallbackInfo<v8::Value>& args);
- static Address GetJsEntrySp();
- static void InitTraceEnv(TickSample* sample);
- static void DoTrace(Address fp);
+ static const int kInvalidFeedbackSlot = -1;
+
+ virtual ~FeedbackSlotInterface() {}
+ virtual int StaticFeedbackSlotCount() = 0;
+ virtual int GetFeedbackSlotCount(Isolate* isolate) = 0;
+ virtual void SetFirstFeedbackSlot(int slot) = 0;
+};
+
+
+class DeferredFeedbackSlotProcessor {
+ public:
+ DeferredFeedbackSlotProcessor()
+ : slot_nodes_(NULL),
+ slot_count_(0) { }
+
+ void add_slot_node(Zone* zone, FeedbackSlotInterface* slot) {
+ int count = slot->StaticFeedbackSlotCount();
+ if (count > 0) {
+ // No need to add to the list
+ slot->SetFirstFeedbackSlot(slot_count_);
+ slot_count_ += count;
+ } else if (count < 0) {
+ if (slot_nodes_ == NULL) {
+ slot_nodes_ = new(zone) ZoneList<FeedbackSlotInterface*>(10, zone);
+ }
+ slot_nodes_->Add(slot, zone);
+ }
+ }
+
+ void ProcessFeedbackSlots(Isolate* isolate) {
+ // Scope analysis must have been done.
+ if (slot_nodes_ == NULL) {
+ return;
+ }
+
+ int current_slot = slot_count_;
+ for (int i = 0; i < slot_nodes_->length(); i++) {
+ FeedbackSlotInterface* slot_interface = slot_nodes_->at(i);
+ int count = slot_interface->GetFeedbackSlotCount(isolate);
+ if (count > 0) {
+ slot_interface->SetFirstFeedbackSlot(current_slot);
+ current_slot += count;
+ }
+ }
+
+ slot_count_ = current_slot;
+ slot_nodes_->Clear();
+ }
+
+ int slot_count() {
+ ASSERT(slot_count_ >= 0);
+ return slot_count_;
+ }
+
private:
- static Address GetFP(const v8::FunctionCallbackInfo<v8::Value>& args);
- static const char* kSource;
+ ZoneList<FeedbackSlotInterface*>* slot_nodes_;
+ int slot_count_;
};
+
} } // namespace v8::internal
-#endif
+#endif // V8_FEEDBACK_SLOTS_H_

Powered by Google App Engine
This is Rietveld 408576698