Commit b0778287 authored by dcarney@chromium.org's avatar dcarney@chromium.org

HandleScopeImplementer::entered_contexts_ should not store handles

R=mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/23672059

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16917 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e48a0989
...@@ -7427,9 +7427,11 @@ void HandleScopeImplementer::IterateThis(ObjectVisitor* v) { ...@@ -7427,9 +7427,11 @@ void HandleScopeImplementer::IterateThis(ObjectVisitor* v) {
v->VisitPointers(blocks()->last(), handle_scope_data_.next); v->VisitPointers(blocks()->last(), handle_scope_data_.next);
} }
if (!saved_contexts_.is_empty()) { List<Context*>* context_lists[2] = { &saved_contexts_, &entered_contexts_};
Object** start = reinterpret_cast<Object**>(&saved_contexts_.first()); for (unsigned i = 0; i < ARRAY_SIZE(context_lists); i++) {
v->VisitPointers(start, start + saved_contexts_.length()); if (context_lists[i]->is_empty()) continue;
Object** start = reinterpret_cast<Object**>(&context_lists[i]->first());
v->VisitPointers(start, start + context_lists[i]->length());
} }
} }
......
...@@ -542,12 +542,12 @@ class HandleScopeImplementer { ...@@ -542,12 +542,12 @@ class HandleScopeImplementer {
inline void DecrementCallDepth() {call_depth_--;} inline void DecrementCallDepth() {call_depth_--;}
inline bool CallDepthIsZero() { return call_depth_ == 0; } inline bool CallDepthIsZero() { return call_depth_ == 0; }
inline void EnterContext(Handle<Object> context); inline void EnterContext(Handle<Context> context);
inline bool LeaveContext(Handle<Object> context); inline bool LeaveContext(Handle<Context> context);
// Returns the last entered context or an empty handle if no // Returns the last entered context or an empty handle if no
// contexts have been entered. // contexts have been entered.
inline Handle<Object> LastEnteredContext(); inline Handle<Context> LastEnteredContext();
inline void SaveContext(Context* context); inline void SaveContext(Context* context);
inline Context* RestoreContext(); inline Context* RestoreContext();
...@@ -592,7 +592,7 @@ class HandleScopeImplementer { ...@@ -592,7 +592,7 @@ class HandleScopeImplementer {
Isolate* isolate_; Isolate* isolate_;
List<internal::Object**> blocks_; List<internal::Object**> blocks_;
// Used as a stack to keep track of entered contexts. // Used as a stack to keep track of entered contexts.
List<Handle<Object> > entered_contexts_; List<Context*> entered_contexts_;
// Used as a stack to keep track of saved contexts. // Used as a stack to keep track of saved contexts.
List<Context*> saved_contexts_; List<Context*> saved_contexts_;
Object** spare_; Object** spare_;
...@@ -630,23 +630,23 @@ bool HandleScopeImplementer::HasSavedContexts() { ...@@ -630,23 +630,23 @@ bool HandleScopeImplementer::HasSavedContexts() {
} }
void HandleScopeImplementer::EnterContext(Handle<Object> context) { void HandleScopeImplementer::EnterContext(Handle<Context> context) {
entered_contexts_.Add(context); entered_contexts_.Add(*context);
} }
bool HandleScopeImplementer::LeaveContext(Handle<Object> context) { bool HandleScopeImplementer::LeaveContext(Handle<Context> context) {
if (entered_contexts_.is_empty()) return false; if (entered_contexts_.is_empty()) return false;
// TODO(dcarney): figure out what's wrong here // TODO(dcarney): figure out what's wrong here
// if (*entered_contexts_.last() != *context) return false; // if (entered_contexts_.last() != *context) return false;
entered_contexts_.RemoveLast(); entered_contexts_.RemoveLast();
return true; return true;
} }
Handle<Object> HandleScopeImplementer::LastEnteredContext() { Handle<Context> HandleScopeImplementer::LastEnteredContext() {
if (entered_contexts_.is_empty()) return Handle<Object>::null(); if (entered_contexts_.is_empty()) return Handle<Context>::null();
return entered_contexts_.last(); return Handle<Context>(entered_contexts_.last());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment