v8::TryCatch* next_;
void* exception_;
void* message_obj_;
- void* message_script_;
void* js_stack_comparable_address_;
bool is_verbose_ : 1;
bool can_continue_ : 1;
i::Object* the_hole = isolate_->heap()->the_hole_value();
exception_ = the_hole;
message_obj_ = the_hole;
- message_script_ = the_hole;
}
__ ldrb(r1, MemOperand(ip));
__ SmiTag(r1);
__ push(r1);
-
- ExternalReference pending_message_script =
- ExternalReference::address_of_pending_message_script(isolate());
- __ mov(ip, Operand(pending_message_script));
- __ ldr(r1, MemOperand(ip));
- __ push(r1);
}
void FullCodeGenerator::ExitFinallyBlock() {
DCHECK(!result_register().is(r1));
// Restore pending message from stack.
- __ pop(r1);
- ExternalReference pending_message_script =
- ExternalReference::address_of_pending_message_script(isolate());
- __ mov(ip, Operand(pending_message_script));
- __ str(r1, MemOperand(ip));
-
__ pop(r1);
__ SmiUntag(r1);
ExternalReference has_pending_message =
__ SmiTag(x11);
__ Push(x10, x11);
-
- ExternalReference pending_message_script =
- ExternalReference::address_of_pending_message_script(isolate());
- __ Mov(x10, pending_message_script);
- __ Ldr(x10, MemOperand(x10));
- __ Push(x10);
}
DCHECK(!result_register().is(x10));
// Restore pending message from stack.
- __ Pop(x10, x11, x12);
- ExternalReference pending_message_script =
- ExternalReference::address_of_pending_message_script(isolate());
- __ Mov(x13, pending_message_script);
- __ Str(x10, MemOperand(x13));
-
- __ SmiUntag(x11);
+ __ Pop(x10, x11);
+ __ SmiUntag(x10);
ExternalReference has_pending_message =
ExternalReference::address_of_has_pending_message(isolate());
__ Mov(x13, has_pending_message);
STATIC_ASSERT(sizeof(bool) == 1); // NOLINT(runtime/sizeof)
- __ Strb(x11, MemOperand(x13));
+ __ Strb(x10, MemOperand(x13));
ExternalReference pending_message_obj =
ExternalReference::address_of_pending_message_obj(isolate());
__ Mov(x13, pending_message_obj);
- __ Str(x12, MemOperand(x13));
+ __ Str(x11, MemOperand(x13));
// Restore result register and cooked return address from the stack.
__ Pop(x10, result_register());
}
-ExternalReference ExternalReference::address_of_pending_message_script(
- Isolate* isolate) {
- return ExternalReference(isolate->pending_message_script_address());
-}
-
-
ExternalReference ExternalReference::address_of_min_int() {
return ExternalReference(reinterpret_cast<void*>(&double_constants.min_int));
}
static ExternalReference scheduled_exception_address(Isolate* isolate);
static ExternalReference address_of_pending_message_obj(Isolate* isolate);
static ExternalReference address_of_has_pending_message(Isolate* isolate);
- static ExternalReference address_of_pending_message_script(Isolate* isolate);
// Static variables containing common double constants.
static ExternalReference address_of_min_int();
ExternalReference::address_of_pending_message_obj(isolate());
ExternalReference message_present =
ExternalReference::address_of_has_pending_message(isolate());
- ExternalReference message_script =
- ExternalReference::address_of_pending_message_script(isolate());
// We keep a record of all paths that enter the finally-block to be able to
// dispatch to the correct continuation point after the statements in the
environment()->Push(result);
environment()->Push(BuildLoadExternal(message_object, kMachAnyTagged));
environment()->Push(BuildLoadExternal(message_present, kMachBool));
- environment()->Push(BuildLoadExternal(message_script, kMachAnyTagged));
// Evaluate the finally-block.
Visit(stmt->finally_block());
// The result value, dispatch token and message is restored from the operand
// stack (this is in sync with FullCodeGenerator::ExitFinallyBlock).
- BuildStoreExternal(message_script, kMachAnyTagged, environment()->Pop());
BuildStoreExternal(message_present, kMachBool, environment()->Pop());
BuildStoreExternal(message_object, kMachAnyTagged, environment()->Pop());
result = environment()->Pop();
// The finally block of a try/finally statement.
class Finally : public NestedStatement {
public:
- static const int kElementCount = 5;
+ static const int kElementCount = 4;
explicit Finally(FullCodeGenerator* codegen) : NestedStatement(codegen) { }
virtual ~Finally() {}
__ mov(edx, Operand::StaticVariable(has_pending_message));
__ SmiTag(edx);
__ push(edx);
-
- ExternalReference pending_message_script =
- ExternalReference::address_of_pending_message_script(isolate());
- __ mov(edx, Operand::StaticVariable(pending_message_script));
- __ push(edx);
}
void FullCodeGenerator::ExitFinallyBlock() {
DCHECK(!result_register().is(edx));
// Restore pending message from stack.
- __ pop(edx);
- ExternalReference pending_message_script =
- ExternalReference::address_of_pending_message_script(isolate());
- __ mov(Operand::StaticVariable(pending_message_script), edx);
-
__ pop(edx);
__ SmiUntag(edx);
ExternalReference has_pending_message =
has_pending_message_ = false;
rethrowing_message_ = false;
pending_message_obj_ = NULL;
- pending_message_script_ = NULL;
scheduled_exception_ = NULL;
}
// Visit the roots from the top for a given thread.
v->VisitPointer(&thread->pending_exception_);
v->VisitPointer(&(thread->pending_message_obj_));
- v->VisitPointer(bit_cast<Object**>(&(thread->pending_message_script_)));
v->VisitPointer(bit_cast<Object**>(&(thread->context_)));
v->VisitPointer(&thread->scheduled_exception_);
block = block->next_) {
v->VisitPointer(bit_cast<Object**>(&(block->exception_)));
v->VisitPointer(bit_cast<Object**>(&(block->message_obj_)));
- v->VisitPointer(bit_cast<Object**>(&(block->message_script_)));
}
// Iterate over pointers on native execution stack.
Handle<Object> message_obj = CreateMessage(exception_handle, location);
thread_local_top()->pending_message_obj_ = *message_obj;
- thread_local_top()->pending_message_script_ = *location->script();
// If the abort-on-uncaught-exception flag is specified, abort on any
// exception not caught by JavaScript, even when an external handler is
DCHECK(handler->rethrow_);
DCHECK(handler->capture_message_);
Object* message = reinterpret_cast<Object*>(handler->message_obj_);
- Object* script = reinterpret_cast<Object*>(handler->message_script_);
DCHECK(message->IsJSMessageObject() || message->IsTheHole());
- DCHECK(script->IsScript() || script->IsTheHole());
thread_local_top()->pending_message_obj_ = message;
- thread_local_top()->pending_message_script_ = script;
}
HandleScope scope(this);
Handle<JSMessageObject> message_obj(
JSMessageObject::cast(thread_local_top_.pending_message_obj_));
- if (!thread_local_top_.pending_message_script_->IsTheHole()) {
- Handle<Script> script(
- Script::cast(thread_local_top_.pending_message_script_));
- int start_pos = message_obj->start_position();
- int end_pos = message_obj->end_position();
- MessageLocation location(script, start_pos, end_pos);
- MessageHandler::ReportMessage(this, &location, message_obj);
- } else {
- MessageHandler::ReportMessage(this, NULL, message_obj);
- }
+ Handle<JSValue> script_wrapper(JSValue::cast(message_obj->script()));
+ Handle<Script> script(Script::cast(script_wrapper->value()));
+ int start_pos = message_obj->start_position();
+ int end_pos = message_obj->end_position();
+ MessageLocation location(script, start_pos, end_pos);
+ MessageHandler::ReportMessage(this, &location, message_obj);
}
}
}
!thread_local_top_.pending_message_obj_->IsTheHole()) {
Handle<JSMessageObject> message_obj(
JSMessageObject::cast(thread_local_top_.pending_message_obj_));
- Handle<Script> script(
- Script::cast(thread_local_top_.pending_message_script_));
+ Handle<JSValue> script_wrapper(JSValue::cast(message_obj->script()));
+ Handle<Script> script(Script::cast(script_wrapper->value()));
int start_pos = message_obj->start_position();
int end_pos = message_obj->end_position();
return MessageLocation(script, start_pos, end_pos);
v8::TryCatch* handler = try_catch_handler();
DCHECK(thread_local_top_.pending_message_obj_->IsJSMessageObject() ||
thread_local_top_.pending_message_obj_->IsTheHole());
- DCHECK(thread_local_top_.pending_message_script_->IsScript() ||
- thread_local_top_.pending_message_script_->IsTheHole());
handler->can_continue_ = true;
handler->has_terminated_ = false;
handler->exception_ = pending_exception();
if (thread_local_top_.pending_message_obj_->IsTheHole()) return true;
handler->message_obj_ = thread_local_top_.pending_message_obj_;
- handler->message_script_ = thread_local_top_.pending_message_script_;
}
return true;
}
bool has_pending_message_;
bool rethrowing_message_;
Object* pending_message_obj_;
- Object* pending_message_script_;
// Use a separate value for scheduled exceptions to preserve the
// invariants that hold about pending_exception. We may want to
void clear_pending_message() {
thread_local_top_.has_pending_message_ = false;
thread_local_top_.pending_message_obj_ = heap_.the_hole_value();
- thread_local_top_.pending_message_script_ = heap_.the_hole_value();
}
v8::TryCatch* try_catch_handler() {
return thread_local_top_.try_catch_handler();
return reinterpret_cast<Address>(&thread_local_top_.has_pending_message_);
}
- Address pending_message_script_address() {
- return reinterpret_cast<Address>(
- &thread_local_top_.pending_message_script_);
- }
-
Object* scheduled_exception() {
DCHECK(has_scheduled_exception());
DCHECK(!thread_local_top_.scheduled_exception_->IsException());
"address_of_pending_message_obj");
Add(ExternalReference::address_of_has_pending_message(isolate).address(),
"address_of_has_pending_message");
- Add(ExternalReference::address_of_pending_message_script(isolate).address(),
- "pending_message_script");
Add(ExternalReference::get_make_code_young_function(isolate).address(),
"Code::MakeCodeYoung");
Add(ExternalReference::cpu_features().address(), "cpu_features");
__ Load(rdx, has_pending_message);
__ Integer32ToSmi(rdx, rdx);
__ Push(rdx);
-
- ExternalReference pending_message_script =
- ExternalReference::address_of_pending_message_script(isolate());
- __ Load(rdx, pending_message_script);
- __ Push(rdx);
}
DCHECK(!result_register().is(rdx));
DCHECK(!result_register().is(rcx));
// Restore pending message from stack.
- __ Pop(rdx);
- ExternalReference pending_message_script =
- ExternalReference::address_of_pending_message_script(isolate());
- __ Store(pending_message_script, rdx);
-
__ Pop(rdx);
__ SmiToInteger32(rdx, rdx);
ExternalReference has_pending_message =