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

remove most Isolate::Current asserts

R=svenpanne@chromium.org
BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16552 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 04c1b38d
...@@ -132,7 +132,6 @@ BUILTIN_LIST_C(DEF_ARG_TYPE) ...@@ -132,7 +132,6 @@ BUILTIN_LIST_C(DEF_ARG_TYPE)
MUST_USE_RESULT static MaybeObject* Builtin_##name( \ MUST_USE_RESULT static MaybeObject* Builtin_##name( \
int args_length, Object** args_object, Isolate* isolate) { \ int args_length, Object** args_object, Isolate* isolate) { \
name##ArgumentsType args(args_length, args_object); \ name##ArgumentsType args(args_length, args_object); \
ASSERT(isolate == Isolate::Current()); \
args.Verify(); \ args.Verify(); \
return Builtin_Impl_##name(args, isolate); \ return Builtin_Impl_##name(args, isolate); \
} \ } \
......
...@@ -60,11 +60,10 @@ class CompilationInfo { ...@@ -60,11 +60,10 @@ class CompilationInfo {
CompilationInfo(Handle<JSFunction> closure, Zone* zone); CompilationInfo(Handle<JSFunction> closure, Zone* zone);
virtual ~CompilationInfo(); virtual ~CompilationInfo();
Isolate* isolate() { Isolate* isolate() const {
ASSERT(Isolate::Current() == isolate_);
return isolate_; return isolate_;
} }
Zone* zone() { return zone_; } Zone* zone() const { return zone_; }
bool is_lazy() const { return IsLazy::decode(flags_); } bool is_lazy() const { return IsLazy::decode(flags_); }
bool is_eval() const { return IsEval::decode(flags_); } bool is_eval() const { return IsEval::decode(flags_); }
bool is_global() const { return IsGlobal::decode(flags_); } bool is_global() const { return IsGlobal::decode(flags_); }
......
...@@ -3422,7 +3422,6 @@ static void StubMessageHandler2(const v8::Debug::Message& message) { ...@@ -3422,7 +3422,6 @@ static void StubMessageHandler2(const v8::Debug::Message& message) {
bool Debugger::StartAgent(const char* name, int port, bool Debugger::StartAgent(const char* name, int port,
bool wait_for_connection) { bool wait_for_connection) {
ASSERT(Isolate::Current() == isolate_);
if (wait_for_connection) { if (wait_for_connection) {
// Suspend V8 if it is already running or set V8 to suspend whenever // Suspend V8 if it is already running or set V8 to suspend whenever
// it starts. // it starts.
...@@ -3443,7 +3442,6 @@ bool Debugger::StartAgent(const char* name, int port, ...@@ -3443,7 +3442,6 @@ bool Debugger::StartAgent(const char* name, int port,
void Debugger::StopAgent() { void Debugger::StopAgent() {
ASSERT(Isolate::Current() == isolate_);
if (agent_ != NULL) { if (agent_ != NULL) {
agent_->Shutdown(); agent_->Shutdown();
agent_->Join(); agent_->Join();
...@@ -3454,7 +3452,6 @@ void Debugger::StopAgent() { ...@@ -3454,7 +3452,6 @@ void Debugger::StopAgent() {
void Debugger::WaitForAgent() { void Debugger::WaitForAgent() {
ASSERT(Isolate::Current() == isolate_);
if (agent_ != NULL) if (agent_ != NULL)
agent_->WaitUntilListening(); agent_->WaitUntilListening();
} }
...@@ -3508,7 +3505,6 @@ EnterDebugger::EnterDebugger(Isolate* isolate) ...@@ -3508,7 +3505,6 @@ EnterDebugger::EnterDebugger(Isolate* isolate)
EnterDebugger::~EnterDebugger() { EnterDebugger::~EnterDebugger() {
ASSERT(Isolate::Current() == isolate_);
Debug* debug = isolate_->debug(); Debug* debug = isolate_->debug();
// Restore to the previous break state. // Restore to the previous break state.
......
...@@ -990,7 +990,6 @@ class DisableBreak BASE_EMBEDDED { ...@@ -990,7 +990,6 @@ class DisableBreak BASE_EMBEDDED {
isolate_->debug()->set_disable_break(disable_break); isolate_->debug()->set_disable_break(disable_break);
} }
~DisableBreak() { ~DisableBreak() {
ASSERT(Isolate::Current() == isolate_);
isolate_->debug()->set_disable_break(prev_disable_break_); isolate_->debug()->set_disable_break(prev_disable_break_);
} }
......
...@@ -43,7 +43,6 @@ Address IC::address() const { ...@@ -43,7 +43,6 @@ Address IC::address() const {
Address result = Assembler::target_address_from_return_address(pc()); Address result = Assembler::target_address_from_return_address(pc());
#ifdef ENABLE_DEBUGGER_SUPPORT #ifdef ENABLE_DEBUGGER_SUPPORT
ASSERT(Isolate::Current() == isolate());
Debug* debug = isolate()->debug(); Debug* debug = isolate()->debug();
// First check if any break points are active if not just return the address // First check if any break points are active if not just return the address
// of the call. // of the call.
......
...@@ -2145,7 +2145,6 @@ void Isolate::InitializeDebugger() { ...@@ -2145,7 +2145,6 @@ void Isolate::InitializeDebugger() {
bool Isolate::Init(Deserializer* des) { bool Isolate::Init(Deserializer* des) {
ASSERT(state_ != INITIALIZED); ASSERT(state_ != INITIALIZED);
ASSERT(Isolate::Current() == this);
TRACE_ISOLATE(init); TRACE_ISOLATE(init);
stress_deopt_count_ = FLAG_deopt_every_n_times; stress_deopt_count_ = FLAG_deopt_every_n_times;
...@@ -2174,8 +2173,7 @@ bool Isolate::Init(Deserializer* des) { ...@@ -2174,8 +2173,7 @@ bool Isolate::Init(Deserializer* des) {
memory_allocator_ = new MemoryAllocator(this); memory_allocator_ = new MemoryAllocator(this);
code_range_ = new CodeRange(this); code_range_ = new CodeRange(this);
// Safe after setting Heap::isolate_, initializing StackGuard and // Safe after setting Heap::isolate_, and initializing StackGuard
// ensuring that Isolate::Current() == this.
heap_.SetStackLimits(); heap_.SetStackLimits();
#define ASSIGN_ELEMENT(CamelName, hacker_name) \ #define ASSIGN_ELEMENT(CamelName, hacker_name) \
......
...@@ -1408,7 +1408,7 @@ class MarkCompactMarkingVisitor ...@@ -1408,7 +1408,7 @@ class MarkCompactMarkingVisitor
INLINE(static void VisitUnmarkedObject(MarkCompactCollector* collector, INLINE(static void VisitUnmarkedObject(MarkCompactCollector* collector,
HeapObject* obj)) { HeapObject* obj)) {
#ifdef DEBUG #ifdef DEBUG
ASSERT(Isolate::Current()->heap()->Contains(obj)); ASSERT(collector->heap()->Contains(obj));
ASSERT(!HEAP->mark_compact_collector()->IsMarked(obj)); ASSERT(!HEAP->mark_compact_collector()->IsMarked(obj));
#endif #endif
Map* map = obj->map(); Map* map = obj->map();
......
...@@ -1185,7 +1185,6 @@ Heap* HeapObject::GetHeap() { ...@@ -1185,7 +1185,6 @@ Heap* HeapObject::GetHeap() {
Heap* heap = Heap* heap =
MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap(); MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap();
ASSERT(heap != NULL); ASSERT(heap != NULL);
ASSERT(heap->isolate() == Isolate::Current());
return heap; return heap;
} }
...@@ -6177,7 +6176,6 @@ SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot) ...@@ -6177,7 +6176,6 @@ SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot)
Relocatable::Relocatable(Isolate* isolate) { Relocatable::Relocatable(Isolate* isolate) {
ASSERT(isolate == Isolate::Current());
isolate_ = isolate; isolate_ = isolate;
prev_ = isolate->relocatable_top(); prev_ = isolate->relocatable_top();
isolate->set_relocatable_top(this); isolate->set_relocatable_top(this);
...@@ -6185,7 +6183,6 @@ Relocatable::Relocatable(Isolate* isolate) { ...@@ -6185,7 +6183,6 @@ Relocatable::Relocatable(Isolate* isolate) {
Relocatable::~Relocatable() { Relocatable::~Relocatable() {
ASSERT(isolate_ == Isolate::Current());
ASSERT_EQ(isolate_->relocatable_top(), this); ASSERT_EQ(isolate_->relocatable_top(), this);
isolate_->set_relocatable_top(prev_); isolate_->set_relocatable_top(prev_);
} }
......
...@@ -1713,9 +1713,7 @@ class HeapObject: public Object { ...@@ -1713,9 +1713,7 @@ class HeapObject: public Object {
// The Heap the object was allocated in. Used also to access Isolate. // The Heap the object was allocated in. Used also to access Isolate.
inline Heap* GetHeap(); inline Heap* GetHeap();
// Convenience method to get current isolate. This method can be // Convenience method to get current isolate.
// accessed only when its result is the same as
// Isolate::Current(), it ASSERTs this. See also comment for GetHeap.
inline Isolate* GetIsolate(); inline Isolate* GetIsolate();
// Converts an address to a HeapObject pointer. // Converts an address to a HeapObject pointer.
......
...@@ -163,7 +163,6 @@ NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Execute( ...@@ -163,7 +163,6 @@ NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Execute(
int* output, int* output,
int output_size, int output_size,
Isolate* isolate) { Isolate* isolate) {
ASSERT(isolate == Isolate::Current());
// Ensure that the minimum stack has been allocated. // Ensure that the minimum stack has been allocated.
RegExpStackScope stack_scope(isolate); RegExpStackScope stack_scope(isolate);
Address stack_base = stack_scope.stack()->stack_base(); Address stack_base = stack_scope.stack()->stack_base();
...@@ -238,7 +237,6 @@ int NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16( ...@@ -238,7 +237,6 @@ int NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16(
Address byte_offset2, Address byte_offset2,
size_t byte_length, size_t byte_length,
Isolate* isolate) { Isolate* isolate) {
ASSERT(isolate == Isolate::Current());
unibrow::Mapping<unibrow::Ecma262Canonicalize>* canonicalize = unibrow::Mapping<unibrow::Ecma262Canonicalize>* canonicalize =
isolate->regexp_macro_assembler_canonicalize(); isolate->regexp_macro_assembler_canonicalize();
// This function is not allowed to cause a garbage collection. // This function is not allowed to cause a garbage collection.
...@@ -271,7 +269,6 @@ int NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16( ...@@ -271,7 +269,6 @@ int NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16(
Address NativeRegExpMacroAssembler::GrowStack(Address stack_pointer, Address NativeRegExpMacroAssembler::GrowStack(Address stack_pointer,
Address* stack_base, Address* stack_base,
Isolate* isolate) { Isolate* isolate) {
ASSERT(isolate == Isolate::Current());
RegExpStack* regexp_stack = isolate->regexp_stack(); RegExpStack* regexp_stack = isolate->regexp_stack();
size_t size = regexp_stack->stack_capacity(); size_t size = regexp_stack->stack_capacity();
Address old_stack_base = regexp_stack->stack_base(); Address old_stack_base = regexp_stack->stack_base();
......
...@@ -39,7 +39,6 @@ RegExpStackScope::RegExpStackScope(Isolate* isolate) ...@@ -39,7 +39,6 @@ RegExpStackScope::RegExpStackScope(Isolate* isolate)
RegExpStackScope::~RegExpStackScope() { RegExpStackScope::~RegExpStackScope() {
ASSERT(Isolate::Current() == regexp_stack_->isolate_);
// Reset the buffer if it has grown. // Reset the buffer if it has grown.
regexp_stack_->Reset(); regexp_stack_->Reset();
} }
......
...@@ -14602,7 +14602,6 @@ static const Runtime::Function kIntrinsicFunctions[] = { ...@@ -14602,7 +14602,6 @@ static const Runtime::Function kIntrinsicFunctions[] = {
MaybeObject* Runtime::InitializeIntrinsicFunctionNames(Heap* heap, MaybeObject* Runtime::InitializeIntrinsicFunctionNames(Heap* heap,
Object* dictionary) { Object* dictionary) {
ASSERT(Isolate::Current()->heap() == heap);
ASSERT(dictionary != NULL); ASSERT(dictionary != NULL);
ASSERT(NameDictionary::cast(dictionary)->NumberOfElements() == 0); ASSERT(NameDictionary::cast(dictionary)->NumberOfElements() == 0);
for (int i = 0; i < kNumFunctions; ++i) { for (int i = 0; i < kNumFunctions; ++i) {
......
...@@ -45,9 +45,7 @@ namespace internal { ...@@ -45,9 +45,7 @@ namespace internal {
StubCache::StubCache(Isolate* isolate) StubCache::StubCache(Isolate* isolate)
: isolate_(isolate) { : isolate_(isolate) { }
ASSERT(isolate == Isolate::Current());
}
void StubCache::Initialize() { void StubCache::Initialize() {
......
...@@ -168,7 +168,6 @@ uint32_t V8::Random(Context* context) { ...@@ -168,7 +168,6 @@ uint32_t V8::Random(Context* context) {
// purposes. So, we keep a different state to prevent informations // purposes. So, we keep a different state to prevent informations
// leaks that could be used in an exploit. // leaks that could be used in an exploit.
uint32_t V8::RandomPrivate(Isolate* isolate) { uint32_t V8::RandomPrivate(Isolate* isolate) {
ASSERT(isolate == Isolate::Current());
return random_base(isolate->private_random_seed()); return random_base(isolate->private_random_seed());
} }
......
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