Made Isolate a mandatory parameter for everything Handle-related.
Unified parameter order of CreateHandle with the rest of v8 on the way. A few Isolate::Current()s had to be introduced, which is not nice, and not every place will win a beauty contest, but we can clean this up later easily in smaller steps. Review URL: https://codereview.chromium.org/12300018 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13717 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
cbe088fffc
commit
fb6776e84a
@ -573,7 +573,8 @@ static MaybeObject* ConstructArgumentsObjectForInlinedFunction(
|
||||
JavaScriptFrame* frame,
|
||||
Handle<JSFunction> inlined_function,
|
||||
int inlined_frame_index) {
|
||||
Factory* factory = Isolate::Current()->factory();
|
||||
Isolate* isolate = inlined_function->GetIsolate();
|
||||
Factory* factory = isolate->factory();
|
||||
Vector<SlotRef> args_slots =
|
||||
SlotRef::ComputeSlotMappingForArguments(
|
||||
frame,
|
||||
@ -584,7 +585,7 @@ static MaybeObject* ConstructArgumentsObjectForInlinedFunction(
|
||||
factory->NewArgumentsObject(inlined_function, args_count);
|
||||
Handle<FixedArray> array = factory->NewFixedArray(args_count);
|
||||
for (int i = 0; i < args_count; ++i) {
|
||||
Handle<Object> value = args_slots[i].GetValue();
|
||||
Handle<Object> value = args_slots[i].GetValue(isolate);
|
||||
array->set(i, *value);
|
||||
}
|
||||
arguments->set_elements(*array);
|
||||
@ -807,14 +808,16 @@ MaybeObject* Accessors::ObjectSetPrototype(JSObject* receiver_raw,
|
||||
Isolate* isolate = receiver_raw->GetIsolate();
|
||||
HandleScope scope(isolate);
|
||||
Handle<JSObject> receiver(receiver_raw);
|
||||
Handle<Object> value(value_raw);
|
||||
Handle<Object> old_value(GetPrototypeSkipHiddenPrototypes(*receiver));
|
||||
Handle<Object> value(value_raw, isolate);
|
||||
Handle<Object> old_value(GetPrototypeSkipHiddenPrototypes(*receiver),
|
||||
isolate);
|
||||
|
||||
MaybeObject* result = receiver->SetPrototype(*value, kSkipHiddenPrototypes);
|
||||
Handle<Object> hresult;
|
||||
if (!result->ToHandle(&hresult, isolate)) return result;
|
||||
|
||||
Handle<Object> new_value(GetPrototypeSkipHiddenPrototypes(*receiver));
|
||||
Handle<Object> new_value(GetPrototypeSkipHiddenPrototypes(*receiver),
|
||||
isolate);
|
||||
if (!new_value->SameValue(*old_value)) {
|
||||
JSObject::EnqueueChangeRecord(receiver, "prototype",
|
||||
isolate->factory()->Proto_symbol(),
|
||||
@ -843,15 +846,15 @@ static v8::Handle<v8::Value> ModuleGetExport(
|
||||
ASSERT(context->IsModuleContext());
|
||||
int slot = info.Data()->Int32Value();
|
||||
Object* value = context->get(slot);
|
||||
Isolate* isolate = instance->GetIsolate();
|
||||
if (value->IsTheHole()) {
|
||||
Handle<String> name = v8::Utils::OpenHandle(*property);
|
||||
Isolate* isolate = instance->GetIsolate();
|
||||
isolate->ScheduleThrow(
|
||||
*isolate->factory()->NewReferenceError("not_defined",
|
||||
HandleVector(&name, 1)));
|
||||
return v8::Handle<v8::Value>();
|
||||
}
|
||||
return v8::Utils::ToLocal(Handle<Object>(value));
|
||||
return v8::Utils::ToLocal(Handle<Object>(value, isolate));
|
||||
}
|
||||
|
||||
|
||||
|
89
src/api.cc
89
src/api.cc
@ -704,27 +704,29 @@ void HandleScope::Leave() {
|
||||
|
||||
|
||||
int HandleScope::NumberOfHandles() {
|
||||
EnsureInitializedForIsolate(
|
||||
i::Isolate::Current(), "HandleScope::NumberOfHandles");
|
||||
return i::HandleScope::NumberOfHandles();
|
||||
i::Isolate* isolate = i::Isolate::Current();
|
||||
if (!EnsureInitializedForIsolate(isolate, "HandleScope::NumberOfHandles")) {
|
||||
return 0;
|
||||
}
|
||||
return i::HandleScope::NumberOfHandles(isolate);
|
||||
}
|
||||
|
||||
|
||||
i::Object** HandleScope::CreateHandle(i::Object* value) {
|
||||
return i::HandleScope::CreateHandle(value, i::Isolate::Current());
|
||||
return i::HandleScope::CreateHandle(i::Isolate::Current(), value);
|
||||
}
|
||||
|
||||
|
||||
i::Object** HandleScope::CreateHandle(i::Isolate* isolate, i::Object* value) {
|
||||
ASSERT(isolate == i::Isolate::Current());
|
||||
return i::HandleScope::CreateHandle(value, isolate);
|
||||
return i::HandleScope::CreateHandle(isolate, value);
|
||||
}
|
||||
|
||||
|
||||
i::Object** HandleScope::CreateHandle(i::HeapObject* value) {
|
||||
ASSERT(value->IsHeapObject());
|
||||
return reinterpret_cast<i::Object**>(
|
||||
i::HandleScope::CreateHandle(value, value->GetIsolate()));
|
||||
i::HandleScope::CreateHandle(value->GetIsolate(), value));
|
||||
}
|
||||
|
||||
|
||||
@ -938,7 +940,7 @@ void Template::Set(v8::Handle<String> name, v8::Handle<Data> value,
|
||||
if (IsDeadCheck(isolate, "v8::Template::Set()")) return;
|
||||
ENTER_V8(isolate);
|
||||
i::HandleScope scope(isolate);
|
||||
i::Handle<i::Object> list(Utils::OpenHandle(this)->property_list());
|
||||
i::Handle<i::Object> list(Utils::OpenHandle(this)->property_list(), isolate);
|
||||
if (list->IsUndefined()) {
|
||||
list = NeanderArray().value();
|
||||
Utils::OpenHandle(this)->set_property_list(*list);
|
||||
@ -964,7 +966,8 @@ Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() {
|
||||
return Local<ObjectTemplate>();
|
||||
}
|
||||
ENTER_V8(isolate);
|
||||
i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template());
|
||||
i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template(),
|
||||
isolate);
|
||||
if (result->IsUndefined()) {
|
||||
result = Utils::OpenHandle(*ObjectTemplate::New());
|
||||
Utils::OpenHandle(this)->set_prototype_template(*result);
|
||||
@ -1144,7 +1147,8 @@ void FunctionTemplate::AddInstancePropertyAccessor(
|
||||
i::Handle<i::AccessorInfo> obj = MakeAccessorInfo(name, getter, setter, data,
|
||||
settings, attributes,
|
||||
signature);
|
||||
i::Handle<i::Object> list(Utils::OpenHandle(this)->property_accessors());
|
||||
i::Handle<i::Object> list(Utils::OpenHandle(this)->property_accessors(),
|
||||
isolate);
|
||||
if (list->IsUndefined()) {
|
||||
list = NeanderArray().value();
|
||||
Utils::OpenHandle(this)->set_property_accessors(*list);
|
||||
@ -1694,10 +1698,10 @@ Local<Value> Script::Id() {
|
||||
i::HandleScope scope(isolate);
|
||||
i::Handle<i::SharedFunctionInfo> function_info = OpenScript(this);
|
||||
i::Handle<i::Script> script(i::Script::cast(function_info->script()));
|
||||
i::Handle<i::Object> id(script->id());
|
||||
i::Handle<i::Object> id(script->id(), isolate);
|
||||
raw_id = *id;
|
||||
}
|
||||
i::Handle<i::Object> id(raw_id);
|
||||
i::Handle<i::Object> id(raw_id, isolate);
|
||||
return Utils::ToLocal(id);
|
||||
}
|
||||
|
||||
@ -1783,7 +1787,7 @@ v8::Local<Value> v8::TryCatch::StackTrace() const {
|
||||
i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj), isolate_);
|
||||
i::Handle<i::String> name = isolate_->factory()->stack_symbol();
|
||||
if (!obj->HasProperty(*name)) return v8::Local<Value>();
|
||||
i::Handle<i::Object> value = i::GetProperty(obj, name);
|
||||
i::Handle<i::Object> value = i::GetProperty(isolate_, obj, name);
|
||||
if (value.is_null()) return v8::Local<Value>();
|
||||
return v8::Utils::ToLocal(scope.CloseAndEscape(value));
|
||||
} else {
|
||||
@ -1829,7 +1833,7 @@ Local<String> Message::Get() const {
|
||||
ENTER_V8(isolate);
|
||||
HandleScope scope;
|
||||
i::Handle<i::Object> obj = Utils::OpenHandle(this);
|
||||
i::Handle<i::String> raw_result = i::MessageHandler::GetMessage(obj);
|
||||
i::Handle<i::String> raw_result = i::MessageHandler::GetMessage(isolate, obj);
|
||||
Local<String> result = Utils::ToLocal(raw_result);
|
||||
return scope.Close(result);
|
||||
}
|
||||
@ -1846,8 +1850,10 @@ v8::Handle<Value> Message::GetScriptResourceName() const {
|
||||
i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
|
||||
// Return this.script.name.
|
||||
i::Handle<i::JSValue> script =
|
||||
i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script()));
|
||||
i::Handle<i::Object> resource_name(i::Script::cast(script->value())->name());
|
||||
i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(),
|
||||
isolate));
|
||||
i::Handle<i::Object> resource_name(i::Script::cast(script->value())->name(),
|
||||
isolate);
|
||||
return scope.Close(Utils::ToLocal(resource_name));
|
||||
}
|
||||
|
||||
@ -1863,8 +1869,9 @@ v8::Handle<Value> Message::GetScriptData() const {
|
||||
i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
|
||||
// Return this.script.data.
|
||||
i::Handle<i::JSValue> script =
|
||||
i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script()));
|
||||
i::Handle<i::Object> data(i::Script::cast(script->value())->data());
|
||||
i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(),
|
||||
isolate));
|
||||
i::Handle<i::Object> data(i::Script::cast(script->value())->data(), isolate);
|
||||
return scope.Close(Utils::ToLocal(data));
|
||||
}
|
||||
|
||||
@ -1878,7 +1885,7 @@ v8::Handle<v8::StackTrace> Message::GetStackTrace() const {
|
||||
HandleScope scope;
|
||||
i::Handle<i::JSMessageObject> message =
|
||||
i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
|
||||
i::Handle<i::Object> stackFramesObj(message->stack_frames());
|
||||
i::Handle<i::Object> stackFramesObj(message->stack_frames(), isolate);
|
||||
if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>();
|
||||
i::Handle<i::JSArray> stackTrace =
|
||||
i::Handle<i::JSArray>::cast(stackFramesObj);
|
||||
@ -2430,7 +2437,7 @@ Local<Boolean> Value::ToBoolean() const {
|
||||
}
|
||||
LOG_API(isolate, "ToBoolean");
|
||||
ENTER_V8(isolate);
|
||||
i::Handle<i::Object> val = i::Execution::ToBoolean(obj);
|
||||
i::Handle<i::Object> val = i::Execution::ToBoolean(isolate, obj);
|
||||
return Local<Boolean>(ToApi<Boolean>(val));
|
||||
}
|
||||
}
|
||||
@ -2594,7 +2601,7 @@ bool Value::BooleanValue() const {
|
||||
if (IsDeadCheck(isolate, "v8::Value::BooleanValue()")) return false;
|
||||
LOG_API(isolate, "BooleanValue");
|
||||
ENTER_V8(isolate);
|
||||
i::Handle<i::Object> value = i::Execution::ToBoolean(obj);
|
||||
i::Handle<i::Object> value = i::Execution::ToBoolean(isolate, obj);
|
||||
return value->IsTrue();
|
||||
}
|
||||
}
|
||||
@ -2697,7 +2704,7 @@ Local<Uint32> Value::ToArrayIndex() const {
|
||||
if (str->AsArrayIndex(&index)) {
|
||||
i::Handle<i::Object> value;
|
||||
if (index <= static_cast<uint32_t>(i::Smi::kMaxValue)) {
|
||||
value = i::Handle<i::Object>(i::Smi::FromInt(index));
|
||||
value = i::Handle<i::Object>(i::Smi::FromInt(index), isolate);
|
||||
} else {
|
||||
value = isolate->factory()->NewNumber(index);
|
||||
}
|
||||
@ -2906,7 +2913,7 @@ Local<Value> v8::Object::Get(v8::Handle<Value> key) {
|
||||
i::Handle<i::Object> self = Utils::OpenHandle(this);
|
||||
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
|
||||
EXCEPTION_PREAMBLE(isolate);
|
||||
i::Handle<i::Object> result = i::GetProperty(self, key_obj);
|
||||
i::Handle<i::Object> result = i::GetProperty(isolate, self, key_obj);
|
||||
has_pending_exception = result.is_null();
|
||||
EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
|
||||
return Utils::ToLocal(result);
|
||||
@ -2952,7 +2959,7 @@ Local<Value> v8::Object::GetPrototype() {
|
||||
return Local<v8::Value>());
|
||||
ENTER_V8(isolate);
|
||||
i::Handle<i::Object> self = Utils::OpenHandle(this);
|
||||
i::Handle<i::Object> result(self->GetPrototype());
|
||||
i::Handle<i::Object> result(self->GetPrototype(), isolate);
|
||||
return Utils::ToLocal(result);
|
||||
}
|
||||
|
||||
@ -3041,7 +3048,7 @@ Local<String> v8::Object::ObjectProtoToString() {
|
||||
ENTER_V8(isolate);
|
||||
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
|
||||
|
||||
i::Handle<i::Object> name(self->class_name());
|
||||
i::Handle<i::Object> name(self->class_name(), isolate);
|
||||
|
||||
// Native implementation of Object.prototype.toString (v8natives.js):
|
||||
// var c = %ClassOf(this);
|
||||
@ -3094,7 +3101,7 @@ Local<Value> v8::Object::GetConstructor() {
|
||||
return Local<v8::Function>());
|
||||
ENTER_V8(isolate);
|
||||
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
|
||||
i::Handle<i::Object> constructor(self->GetConstructor());
|
||||
i::Handle<i::Object> constructor(self->GetConstructor(), isolate);
|
||||
return Utils::ToLocal(constructor);
|
||||
}
|
||||
|
||||
@ -3725,7 +3732,7 @@ Local<v8::Value> Function::Call(v8::Handle<v8::Object> recv, int argc,
|
||||
EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Object>());
|
||||
raw_result = *returned;
|
||||
}
|
||||
i::Handle<i::Object> result(raw_result);
|
||||
i::Handle<i::Object> result(raw_result, isolate);
|
||||
return Utils::ToLocal(result);
|
||||
}
|
||||
|
||||
@ -3741,13 +3748,15 @@ void Function::SetName(v8::Handle<v8::String> name) {
|
||||
|
||||
Handle<Value> Function::GetName() const {
|
||||
i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
|
||||
return Utils::ToLocal(i::Handle<i::Object>(func->shared()->name()));
|
||||
return Utils::ToLocal(i::Handle<i::Object>(func->shared()->name(),
|
||||
func->GetIsolate()));
|
||||
}
|
||||
|
||||
|
||||
Handle<Value> Function::GetInferredName() const {
|
||||
i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
|
||||
return Utils::ToLocal(i::Handle<i::Object>(func->shared()->inferred_name()));
|
||||
return Utils::ToLocal(i::Handle<i::Object>(func->shared()->inferred_name(),
|
||||
func->GetIsolate()));
|
||||
}
|
||||
|
||||
|
||||
@ -3793,7 +3802,7 @@ Handle<Value> Function::GetScriptId() const {
|
||||
if (!func->shared()->script()->IsScript())
|
||||
return v8::Undefined();
|
||||
i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
|
||||
return Utils::ToLocal(i::Handle<i::Object>(script->id()));
|
||||
return Utils::ToLocal(i::Handle<i::Object>(script->id(), func->GetIsolate()));
|
||||
}
|
||||
|
||||
int String::Length() const {
|
||||
@ -4616,7 +4625,7 @@ Handle<Value> v8::Context::GetSecurityToken() {
|
||||
}
|
||||
i::Handle<i::Context> env = Utils::OpenHandle(this);
|
||||
i::Object* security_token = env->security_token();
|
||||
i::Handle<i::Object> token_handle(security_token);
|
||||
i::Handle<i::Object> token_handle(security_token, isolate);
|
||||
return Utils::ToLocal(token_handle);
|
||||
}
|
||||
|
||||
@ -4752,7 +4761,7 @@ void Context::SetErrorMessageForCodeGenerationFromStrings(
|
||||
i::Object** ctx = reinterpret_cast<i::Object**>(this);
|
||||
i::Handle<i::Context> context =
|
||||
i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx));
|
||||
i::Handle<i::Object> error_handle = Utils::OpenHandle(*error);
|
||||
i::Handle<i::String> error_handle = Utils::OpenHandle(*error);
|
||||
context->set_error_message_for_code_gen_from_strings(*error_handle);
|
||||
}
|
||||
|
||||
@ -5037,8 +5046,10 @@ Local<v8::Value> v8::BooleanObject::New(bool value) {
|
||||
EnsureInitializedForIsolate(isolate, "v8::BooleanObject::New()");
|
||||
LOG_API(isolate, "BooleanObject::New");
|
||||
ENTER_V8(isolate);
|
||||
i::Handle<i::Object> boolean(value ? isolate->heap()->true_value()
|
||||
: isolate->heap()->false_value());
|
||||
i::Handle<i::Object> boolean(value
|
||||
? isolate->heap()->true_value()
|
||||
: isolate->heap()->false_value(),
|
||||
isolate);
|
||||
i::Handle<i::Object> obj = isolate->factory()->ToObject(boolean);
|
||||
return Utils::ToLocal(obj);
|
||||
}
|
||||
@ -5692,7 +5703,7 @@ Local<Value> Exception::RangeError(v8::Handle<v8::String> raw_message) {
|
||||
i::Handle<i::Object> result = isolate->factory()->NewRangeError(message);
|
||||
error = *result;
|
||||
}
|
||||
i::Handle<i::Object> result(error);
|
||||
i::Handle<i::Object> result(error, isolate);
|
||||
return Utils::ToLocal(result);
|
||||
}
|
||||
|
||||
@ -5709,7 +5720,7 @@ Local<Value> Exception::ReferenceError(v8::Handle<v8::String> raw_message) {
|
||||
isolate->factory()->NewReferenceError(message);
|
||||
error = *result;
|
||||
}
|
||||
i::Handle<i::Object> result(error);
|
||||
i::Handle<i::Object> result(error, isolate);
|
||||
return Utils::ToLocal(result);
|
||||
}
|
||||
|
||||
@ -5725,7 +5736,7 @@ Local<Value> Exception::SyntaxError(v8::Handle<v8::String> raw_message) {
|
||||
i::Handle<i::Object> result = isolate->factory()->NewSyntaxError(message);
|
||||
error = *result;
|
||||
}
|
||||
i::Handle<i::Object> result(error);
|
||||
i::Handle<i::Object> result(error, isolate);
|
||||
return Utils::ToLocal(result);
|
||||
}
|
||||
|
||||
@ -5741,7 +5752,7 @@ Local<Value> Exception::TypeError(v8::Handle<v8::String> raw_message) {
|
||||
i::Handle<i::Object> result = isolate->factory()->NewTypeError(message);
|
||||
error = *result;
|
||||
}
|
||||
i::Handle<i::Object> result(error);
|
||||
i::Handle<i::Object> result(error, isolate);
|
||||
return Utils::ToLocal(result);
|
||||
}
|
||||
|
||||
@ -5757,7 +5768,7 @@ Local<Value> Exception::Error(v8::Handle<v8::String> raw_message) {
|
||||
i::Handle<i::Object> result = isolate->factory()->NewError(message);
|
||||
error = *result;
|
||||
}
|
||||
i::Handle<i::Object> result(error);
|
||||
i::Handle<i::Object> result(error, isolate);
|
||||
return Utils::ToLocal(result);
|
||||
}
|
||||
|
||||
@ -5961,7 +5972,7 @@ Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) {
|
||||
i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object());
|
||||
i::Handle<i::String> name = isolate->factory()->LookupOneByteSymbol(
|
||||
STATIC_ASCII_VECTOR("MakeMirror"));
|
||||
i::Handle<i::Object> fun_obj = i::GetProperty(debug, name);
|
||||
i::Handle<i::Object> fun_obj = i::GetProperty(isolate, debug, name);
|
||||
i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj);
|
||||
v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun);
|
||||
const int kArgc = 1;
|
||||
|
@ -1164,7 +1164,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
Handle<JSGlobalPropertyCell> cell =
|
||||
isolate()->factory()->NewJSGlobalPropertyCell(
|
||||
Handle<Object>(
|
||||
Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker)));
|
||||
Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker),
|
||||
isolate()));
|
||||
RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell);
|
||||
__ LoadHeapObject(r1, cell);
|
||||
__ mov(r2, Operand(Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker)));
|
||||
|
@ -5740,7 +5740,8 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
|
||||
// Copy in-object properties.
|
||||
for (int i = 0; i < inobject_properties; i++) {
|
||||
int total_offset = object_offset + object->GetInObjectPropertyOffset(i);
|
||||
Handle<Object> value = Handle<Object>(object->InObjectPropertyAt(i));
|
||||
Handle<Object> value = Handle<Object>(object->InObjectPropertyAt(i),
|
||||
isolate());
|
||||
if (value->IsJSObject()) {
|
||||
Handle<JSObject> value_object = Handle<JSObject>::cast(value);
|
||||
__ add(r2, result, Operand(*offset));
|
||||
@ -5794,7 +5795,7 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
|
||||
Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements);
|
||||
for (int i = 0; i < elements_length; i++) {
|
||||
int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i);
|
||||
Handle<Object> value(fast_elements->get(i));
|
||||
Handle<Object> value(fast_elements->get(i), isolate());
|
||||
if (value->IsJSObject()) {
|
||||
Handle<JSObject> value_object = Handle<JSObject>::cast(value);
|
||||
__ add(r2, result, Operand(*offset));
|
||||
|
@ -425,7 +425,8 @@ void MacroAssembler::LoadRoot(Register destination,
|
||||
if (CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS) &&
|
||||
!Heap::RootCanBeWrittenAfterInitialization(index) &&
|
||||
!predictable_code_size()) {
|
||||
Handle<Object> root(isolate()->heap()->roots_array_start()[index]);
|
||||
Handle<Object> root(isolate()->heap()->roots_array_start()[index],
|
||||
isolate());
|
||||
if (!isolate()->heap()->InNewSpace(*root)) {
|
||||
// The CPU supports fast immediate values, and this root will never
|
||||
// change. We will load it as a relocatable immediate value.
|
||||
@ -2241,13 +2242,13 @@ static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
|
||||
void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function,
|
||||
int stack_space) {
|
||||
ExternalReference next_address =
|
||||
ExternalReference::handle_scope_next_address();
|
||||
ExternalReference::handle_scope_next_address(isolate());
|
||||
const int kNextOffset = 0;
|
||||
const int kLimitOffset = AddressOffset(
|
||||
ExternalReference::handle_scope_limit_address(),
|
||||
ExternalReference::handle_scope_limit_address(isolate()),
|
||||
next_address);
|
||||
const int kLevelOffset = AddressOffset(
|
||||
ExternalReference::handle_scope_level_address(),
|
||||
ExternalReference::handle_scope_level_address(isolate()),
|
||||
next_address);
|
||||
|
||||
// Allocate HandleScope in callee-save registers.
|
||||
|
@ -308,7 +308,7 @@ class MacroAssembler: public Assembler {
|
||||
|
||||
// Push a handle.
|
||||
void Push(Handle<Object> handle);
|
||||
void Push(Smi* smi) { Push(Handle<Smi>(smi)); }
|
||||
void Push(Smi* smi) { Push(Handle<Smi>(smi, isolate())); }
|
||||
|
||||
// Push two registers. Pushes leftmost register first (to highest address).
|
||||
void Push(Register src1, Register src2, Condition cond = al) {
|
||||
|
@ -711,7 +711,7 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm,
|
||||
|
||||
// Pass the additional arguments.
|
||||
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
|
||||
Handle<Object> call_data(api_call_info->data());
|
||||
Handle<Object> call_data(api_call_info->data(), masm->isolate());
|
||||
if (masm->isolate()->heap()->InNewSpace(*call_data)) {
|
||||
__ Move(r0, api_call_info);
|
||||
__ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kDataOffset));
|
||||
@ -1283,7 +1283,7 @@ void StubCompiler::GenerateLoadCallback(
|
||||
__ ldr(scratch3,
|
||||
FieldMemOperand(scratch3, ExecutableAccessorInfo::kDataOffset));
|
||||
} else {
|
||||
__ Move(scratch3, Handle<Object>(callback->data()));
|
||||
__ Move(scratch3, Handle<Object>(callback->data(), isolate()));
|
||||
}
|
||||
__ Push(reg, scratch3);
|
||||
__ mov(scratch3, Operand(ExternalReference::isolate_address()));
|
||||
@ -3338,7 +3338,8 @@ Handle<Code> ConstructStubCompiler::CompileConstructStub(
|
||||
__ bind(&next);
|
||||
} else {
|
||||
// Set the property to the constant value.
|
||||
Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i));
|
||||
Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i),
|
||||
isolate());
|
||||
__ mov(r2, Operand(constant));
|
||||
__ str(r2, MemOperand(r5, kPointerSize, PostIndex));
|
||||
}
|
||||
|
@ -1157,18 +1157,21 @@ ExternalReference ExternalReference::new_space_allocation_limit_address(
|
||||
}
|
||||
|
||||
|
||||
ExternalReference ExternalReference::handle_scope_level_address() {
|
||||
return ExternalReference(HandleScope::current_level_address());
|
||||
ExternalReference ExternalReference::handle_scope_level_address(
|
||||
Isolate* isolate) {
|
||||
return ExternalReference(HandleScope::current_level_address(isolate));
|
||||
}
|
||||
|
||||
|
||||
ExternalReference ExternalReference::handle_scope_next_address() {
|
||||
return ExternalReference(HandleScope::current_next_address());
|
||||
ExternalReference ExternalReference::handle_scope_next_address(
|
||||
Isolate* isolate) {
|
||||
return ExternalReference(HandleScope::current_next_address(isolate));
|
||||
}
|
||||
|
||||
|
||||
ExternalReference ExternalReference::handle_scope_limit_address() {
|
||||
return ExternalReference(HandleScope::current_limit_address());
|
||||
ExternalReference ExternalReference::handle_scope_limit_address(
|
||||
Isolate* isolate) {
|
||||
return ExternalReference(HandleScope::current_limit_address(isolate));
|
||||
}
|
||||
|
||||
|
||||
|
@ -724,9 +724,9 @@ class ExternalReference BASE_EMBEDDED {
|
||||
static ExternalReference power_double_double_function(Isolate* isolate);
|
||||
static ExternalReference power_double_int_function(Isolate* isolate);
|
||||
|
||||
static ExternalReference handle_scope_next_address();
|
||||
static ExternalReference handle_scope_limit_address();
|
||||
static ExternalReference handle_scope_level_address();
|
||||
static ExternalReference handle_scope_next_address(Isolate* isolate);
|
||||
static ExternalReference handle_scope_limit_address(Isolate* isolate);
|
||||
static ExternalReference handle_scope_level_address(Isolate* isolate);
|
||||
|
||||
static ExternalReference scheduled_exception_address(Isolate* isolate);
|
||||
static ExternalReference address_of_pending_message_obj(Isolate* isolate);
|
||||
|
@ -86,7 +86,8 @@ Handle<String> Bootstrapper::NativesSourceLookup(int index) {
|
||||
isolate_->factory()->NewExternalStringFromAscii(resource);
|
||||
heap->natives_source_cache()->set(index, *source_code);
|
||||
}
|
||||
Handle<Object> cached_source(heap->natives_source_cache()->get(index));
|
||||
Handle<Object> cached_source(heap->natives_source_cache()->get(index),
|
||||
isolate_);
|
||||
return Handle<String>::cast(cached_source);
|
||||
}
|
||||
|
||||
@ -722,7 +723,8 @@ Handle<JSGlobalProxy> Genesis::CreateNewGlobals(
|
||||
Handle<FunctionTemplateInfo> global_constructor =
|
||||
Handle<FunctionTemplateInfo>(
|
||||
FunctionTemplateInfo::cast(data->constructor()));
|
||||
Handle<Object> proto_template(global_constructor->prototype_template());
|
||||
Handle<Object> proto_template(global_constructor->prototype_template(),
|
||||
isolate());
|
||||
if (!proto_template->IsUndefined()) {
|
||||
js_global_template =
|
||||
Handle<ObjectTemplateInfo>::cast(proto_template);
|
||||
@ -1389,7 +1391,8 @@ bool Genesis::CompileScriptCached(Isolate* isolate,
|
||||
Handle<Object> receiver =
|
||||
Handle<Object>(use_runtime_context
|
||||
? top_context->builtins()
|
||||
: top_context->global_object());
|
||||
: top_context->global_object(),
|
||||
isolate);
|
||||
bool has_pending_exception;
|
||||
Execution::Call(fun, receiver, 0, NULL, &has_pending_exception);
|
||||
if (has_pending_exception) return false;
|
||||
@ -1532,7 +1535,7 @@ bool Genesis::InstallNatives() {
|
||||
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
|
||||
Handle<String> global_symbol =
|
||||
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("global"));
|
||||
Handle<Object> global_obj(native_context()->global_object());
|
||||
Handle<Object> global_obj(native_context()->global_object(), isolate());
|
||||
CHECK_NOT_EMPTY_HANDLE(isolate(),
|
||||
JSObject::SetLocalPropertyIgnoreAttributes(
|
||||
builtins, global_symbol, global_obj, attributes));
|
||||
@ -1767,7 +1770,8 @@ bool Genesis::InstallNatives() {
|
||||
// Install Function.prototype.call and apply.
|
||||
{ Handle<String> key = factory()->function_class_symbol();
|
||||
Handle<JSFunction> function =
|
||||
Handle<JSFunction>::cast(GetProperty(isolate()->global_object(), key));
|
||||
Handle<JSFunction>::cast(
|
||||
GetProperty(isolate(), isolate()->global_object(), key));
|
||||
Handle<JSObject> proto =
|
||||
Handle<JSObject>(JSObject::cast(function->instance_prototype()));
|
||||
|
||||
@ -1896,18 +1900,19 @@ bool Genesis::InstallExperimentalNatives() {
|
||||
static Handle<JSObject> ResolveBuiltinIdHolder(
|
||||
Handle<Context> native_context,
|
||||
const char* holder_expr) {
|
||||
Factory* factory = native_context->GetIsolate()->factory();
|
||||
Isolate* isolate = native_context->GetIsolate();
|
||||
Factory* factory = isolate->factory();
|
||||
Handle<GlobalObject> global(native_context->global_object());
|
||||
const char* period_pos = strchr(holder_expr, '.');
|
||||
if (period_pos == NULL) {
|
||||
return Handle<JSObject>::cast(
|
||||
GetProperty(global, factory->LookupUtf8Symbol(holder_expr)));
|
||||
GetProperty(isolate, global, factory->LookupUtf8Symbol(holder_expr)));
|
||||
}
|
||||
ASSERT_EQ(".prototype", period_pos);
|
||||
Vector<const char> property(holder_expr,
|
||||
static_cast<int>(period_pos - holder_expr));
|
||||
Handle<JSFunction> function = Handle<JSFunction>::cast(
|
||||
GetProperty(global, factory->LookupUtf8Symbol(property)));
|
||||
GetProperty(isolate, global, factory->LookupUtf8Symbol(property)));
|
||||
return Handle<JSObject>(JSObject::cast(function->prototype()));
|
||||
}
|
||||
|
||||
@ -2018,7 +2023,8 @@ void Genesis::InstallSpecialObjects(Handle<Context> native_context) {
|
||||
if (Error->IsJSObject()) {
|
||||
Handle<String> name =
|
||||
factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("stackTraceLimit"));
|
||||
Handle<Smi> stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit));
|
||||
Handle<Smi> stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit),
|
||||
isolate);
|
||||
CHECK_NOT_EMPTY_HANDLE(isolate,
|
||||
JSObject::SetLocalPropertyIgnoreAttributes(
|
||||
Handle<JSObject>::cast(Error), name,
|
||||
@ -2040,7 +2046,8 @@ void Genesis::InstallSpecialObjects(Handle<Context> native_context) {
|
||||
|
||||
Handle<String> debug_string =
|
||||
factory->LookupUtf8Symbol(FLAG_expose_debug_as);
|
||||
Handle<Object> global_proxy(debug->debug_context()->global_proxy());
|
||||
Handle<Object> global_proxy(debug->debug_context()->global_proxy(),
|
||||
isolate);
|
||||
CHECK_NOT_EMPTY_HANDLE(isolate,
|
||||
JSObject::SetLocalPropertyIgnoreAttributes(
|
||||
global, debug_string, global_proxy, DONT_ENUM));
|
||||
@ -2255,8 +2262,9 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
|
||||
HandleScope inner(isolate());
|
||||
Handle<String> key = Handle<String>(descs->GetKey(i));
|
||||
int index = descs->GetFieldIndex(i);
|
||||
Handle<Object> value = Handle<Object>(from->FastPropertyAt(index));
|
||||
CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(),
|
||||
Handle<Object> value = Handle<Object>(from->FastPropertyAt(index),
|
||||
isolate());
|
||||
CHECK_NOT_EMPTY_HANDLE(isolate(),
|
||||
JSObject::SetLocalPropertyIgnoreAttributes(
|
||||
to, key, value, details.attributes()));
|
||||
break;
|
||||
@ -2266,7 +2274,7 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
|
||||
Handle<String> key = Handle<String>(descs->GetKey(i));
|
||||
Handle<JSFunction> fun =
|
||||
Handle<JSFunction>(descs->GetConstantFunction(i));
|
||||
CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(),
|
||||
CHECK_NOT_EMPTY_HANDLE(isolate(),
|
||||
JSObject::SetLocalPropertyIgnoreAttributes(
|
||||
to, key, fun, details.attributes()));
|
||||
break;
|
||||
@ -2280,7 +2288,7 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
|
||||
ASSERT(!to->HasFastProperties());
|
||||
// Add to dictionary.
|
||||
Handle<String> key = Handle<String>(descs->GetKey(i));
|
||||
Handle<Object> callbacks(descs->GetCallbacksObject(i));
|
||||
Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate());
|
||||
PropertyDetails d = PropertyDetails(details.attributes(),
|
||||
CALLBACKS,
|
||||
details.descriptor_index());
|
||||
@ -2312,12 +2320,14 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
|
||||
if (result.IsFound()) continue;
|
||||
// Set the property.
|
||||
Handle<String> key = Handle<String>(String::cast(raw_key));
|
||||
Handle<Object> value = Handle<Object>(properties->ValueAt(i));
|
||||
Handle<Object> value = Handle<Object>(properties->ValueAt(i),
|
||||
isolate());
|
||||
if (value->IsJSGlobalPropertyCell()) {
|
||||
value = Handle<Object>(JSGlobalPropertyCell::cast(*value)->value());
|
||||
value = Handle<Object>(JSGlobalPropertyCell::cast(*value)->value(),
|
||||
isolate());
|
||||
}
|
||||
PropertyDetails details = properties->DetailsAt(i);
|
||||
CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(),
|
||||
CHECK_NOT_EMPTY_HANDLE(isolate(),
|
||||
JSObject::SetLocalPropertyIgnoreAttributes(
|
||||
to, key, value, details.attributes()));
|
||||
}
|
||||
|
@ -36,9 +36,10 @@ namespace internal {
|
||||
|
||||
|
||||
static LChunk* OptimizeGraph(HGraph* graph) {
|
||||
Isolate* isolate = graph->isolate();
|
||||
AssertNoAllocation no_gc;
|
||||
NoHandleAllocation no_handles;
|
||||
NoHandleDereference no_deref;
|
||||
NoHandleAllocation no_handles(isolate);
|
||||
NoHandleDereference no_deref(isolate);
|
||||
|
||||
ASSERT(graph != NULL);
|
||||
SmartArrayPointer<char> bailout_reason;
|
||||
|
@ -308,12 +308,10 @@ bool ICCompareStub::FindCodeInSpecialCache(Code** code_out, Isolate* isolate) {
|
||||
static_cast<Code::Kind>(GetCodeKind()),
|
||||
UNINITIALIZED);
|
||||
ASSERT(op_ == Token::EQ || op_ == Token::EQ_STRICT);
|
||||
Handle<Object> probe(
|
||||
known_map_->FindInCodeCache(
|
||||
strict() ?
|
||||
*factory->strict_compare_ic_symbol() :
|
||||
*factory->compare_ic_symbol(),
|
||||
flags));
|
||||
String* symbol = strict() ?
|
||||
*factory->strict_compare_ic_symbol() :
|
||||
*factory->compare_ic_symbol();
|
||||
Handle<Object> probe(known_map_->FindInCodeCache(symbol, flags), isolate);
|
||||
if (probe->IsCode()) {
|
||||
*code_out = Code::cast(*probe);
|
||||
#ifdef DEBUG
|
||||
|
@ -394,8 +394,8 @@ OptimizingCompiler::Status OptimizingCompiler::CreateGraph() {
|
||||
|
||||
OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() {
|
||||
AssertNoAllocation no_gc;
|
||||
NoHandleAllocation no_handles;
|
||||
NoHandleDereference no_deref;
|
||||
NoHandleAllocation no_handles(isolate());
|
||||
NoHandleDereference no_deref(isolate());
|
||||
|
||||
ASSERT(last_status() == SUCCEEDED);
|
||||
Timer t(this, &time_taken_to_optimize_);
|
||||
|
@ -424,6 +424,7 @@ class OptimizingCompiler: public ZoneObject {
|
||||
|
||||
Status last_status() const { return last_status_; }
|
||||
CompilationInfo* info() const { return info_; }
|
||||
Isolate* isolate() const { return info()->isolate(); }
|
||||
|
||||
MUST_USE_RESULT Status AbortOptimization() {
|
||||
info_->AbortOptimization();
|
||||
|
@ -327,14 +327,11 @@ void Context::ClearOptimizedFunctions() {
|
||||
|
||||
|
||||
Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() {
|
||||
Handle<Object> result(error_message_for_code_gen_from_strings());
|
||||
if (result->IsUndefined()) {
|
||||
const char* error =
|
||||
"Code generation from strings disallowed for this context";
|
||||
Isolate* isolate = Isolate::Current();
|
||||
result = isolate->factory()->NewStringFromAscii(i::CStrVector(error));
|
||||
}
|
||||
return result;
|
||||
Handle<Object> result(error_message_for_code_gen_from_strings(),
|
||||
GetIsolate());
|
||||
if (!result->IsUndefined()) return result;
|
||||
return GetIsolate()->factory()->NewStringFromAscii(i::CStrVector(
|
||||
"Code generation from strings disallowed for this context"));
|
||||
}
|
||||
|
||||
|
||||
@ -343,7 +340,7 @@ bool Context::IsBootstrappingOrValidParentContext(
|
||||
Object* object, Context* child) {
|
||||
// During bootstrapping we allow all objects to pass as
|
||||
// contexts. This is necessary to fix circular dependencies.
|
||||
if (Isolate::Current()->bootstrapper()->IsActive()) return true;
|
||||
if (child->GetIsolate()->bootstrapper()->IsActive()) return true;
|
||||
if (!object->IsContext()) return false;
|
||||
Context* context = Context::cast(object);
|
||||
return context->IsNativeContext() || context->IsGlobalContext() ||
|
||||
|
53
src/debug.cc
53
src/debug.cc
@ -778,8 +778,11 @@ bool Debug::CompileDebuggerScript(int index) {
|
||||
factory->NewFunctionFromSharedFunctionInfo(function_info, context);
|
||||
|
||||
Handle<Object> exception =
|
||||
Execution::TryCall(function, Handle<Object>(context->global_object()),
|
||||
0, NULL, &caught_exception);
|
||||
Execution::TryCall(function,
|
||||
Handle<Object>(context->global_object(), isolate),
|
||||
0,
|
||||
NULL,
|
||||
&caught_exception);
|
||||
|
||||
// Check for caught exceptions.
|
||||
if (caught_exception) {
|
||||
@ -844,8 +847,11 @@ bool Debug::Load() {
|
||||
Handle<GlobalObject> global = Handle<GlobalObject>(context->global_object());
|
||||
RETURN_IF_EMPTY_HANDLE_VALUE(
|
||||
isolate_,
|
||||
JSReceiver::SetProperty(global, key, Handle<Object>(global->builtins()),
|
||||
NONE, kNonStrictMode),
|
||||
JSReceiver::SetProperty(global,
|
||||
key,
|
||||
Handle<Object>(global->builtins(), isolate_),
|
||||
NONE,
|
||||
kNonStrictMode),
|
||||
false);
|
||||
|
||||
// Compile the JavaScript for the debugger in the debugger context.
|
||||
@ -950,10 +956,10 @@ Object* Debug::Break(Arguments args) {
|
||||
|
||||
// If there is one or more real break points check whether any of these are
|
||||
// triggered.
|
||||
Handle<Object> break_points_hit(heap->undefined_value());
|
||||
Handle<Object> break_points_hit(heap->undefined_value(), isolate_);
|
||||
if (break_location_iterator.HasBreakPoint()) {
|
||||
Handle<Object> break_point_objects =
|
||||
Handle<Object>(break_location_iterator.BreakPointObjects());
|
||||
Handle<Object>(break_location_iterator.BreakPointObjects(), isolate_);
|
||||
break_points_hit = CheckBreakPoints(break_point_objects);
|
||||
}
|
||||
|
||||
@ -1071,7 +1077,7 @@ Handle<Object> Debug::CheckBreakPoints(Handle<Object> break_point_objects) {
|
||||
Handle<FixedArray> array(FixedArray::cast(*break_point_objects));
|
||||
break_points_hit = factory->NewFixedArray(array->length());
|
||||
for (int i = 0; i < array->length(); i++) {
|
||||
Handle<Object> o(array->get(i));
|
||||
Handle<Object> o(array->get(i), isolate_);
|
||||
if (CheckBreakPoint(o)) {
|
||||
break_points_hit->set(break_points_hit_count++, *o);
|
||||
}
|
||||
@ -1294,7 +1300,8 @@ void Debug::FloodWithOneShot(Handle<JSFunction> function) {
|
||||
|
||||
void Debug::FloodBoundFunctionWithOneShot(Handle<JSFunction> function) {
|
||||
Handle<FixedArray> new_bindings(function->function_bindings());
|
||||
Handle<Object> bindee(new_bindings->get(JSFunction::kBoundFunctionIndex));
|
||||
Handle<Object> bindee(new_bindings->get(JSFunction::kBoundFunctionIndex),
|
||||
isolate_);
|
||||
|
||||
if (!bindee.is_null() && bindee->IsJSFunction() &&
|
||||
!JSFunction::cast(*bindee)->IsBuiltin()) {
|
||||
@ -1492,7 +1499,8 @@ void Debug::PrepareStep(StepAction step_action, int step_count) {
|
||||
// from the code object.
|
||||
Handle<Object> obj(
|
||||
isolate_->heap()->code_stubs()->SlowReverseLookup(
|
||||
*call_function_stub));
|
||||
*call_function_stub),
|
||||
isolate_);
|
||||
ASSERT(!obj.is_null());
|
||||
ASSERT(!(*obj)->IsUndefined());
|
||||
ASSERT(obj->IsSmi());
|
||||
@ -1665,10 +1673,12 @@ Handle<Object> Debug::GetSourceBreakLocations(
|
||||
Handle<SharedFunctionInfo> shared) {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Heap* heap = isolate->heap();
|
||||
if (!HasDebugInfo(shared)) return Handle<Object>(heap->undefined_value());
|
||||
if (!HasDebugInfo(shared)) {
|
||||
return Handle<Object>(heap->undefined_value(), isolate);
|
||||
}
|
||||
Handle<DebugInfo> debug_info = GetDebugInfo(shared);
|
||||
if (debug_info->GetBreakPointCount() == 0) {
|
||||
return Handle<Object>(heap->undefined_value());
|
||||
return Handle<Object>(heap->undefined_value(), isolate);
|
||||
}
|
||||
Handle<FixedArray> locations =
|
||||
isolate->factory()->NewFixedArray(debug_info->GetBreakPointCount());
|
||||
@ -2434,8 +2444,8 @@ void Debug::ClearMirrorCache() {
|
||||
Handle<String> function_name = isolate_->factory()->LookupOneByteSymbol(
|
||||
STATIC_ASCII_VECTOR("ClearMirrorCache"));
|
||||
Handle<Object> fun(
|
||||
Isolate::Current()->global_object()->GetPropertyNoExceptionThrown(
|
||||
*function_name));
|
||||
isolate_->global_object()->GetPropertyNoExceptionThrown(*function_name),
|
||||
isolate_);
|
||||
ASSERT(fun->IsJSFunction());
|
||||
bool caught_exception;
|
||||
Execution::TryCall(Handle<JSFunction>::cast(fun),
|
||||
@ -2562,8 +2572,8 @@ Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name,
|
||||
Handle<String> constructor_str =
|
||||
isolate_->factory()->LookupUtf8Symbol(constructor_name);
|
||||
Handle<Object> constructor(
|
||||
isolate_->global_object()->GetPropertyNoExceptionThrown(
|
||||
*constructor_str));
|
||||
isolate_->global_object()->GetPropertyNoExceptionThrown(*constructor_str),
|
||||
isolate_);
|
||||
ASSERT(constructor->IsJSFunction());
|
||||
if (!constructor->IsJSFunction()) {
|
||||
*caught_exception = true;
|
||||
@ -2651,7 +2661,7 @@ Handle<Object> Debugger::MakeScriptCollectedEvent(int id,
|
||||
bool* caught_exception) {
|
||||
// Create the script collected event object.
|
||||
Handle<Object> exec_state = MakeExecutionState(caught_exception);
|
||||
Handle<Object> id_object = Handle<Smi>(Smi::FromInt(id));
|
||||
Handle<Object> id_object = Handle<Smi>(Smi::FromInt(id), isolate_);
|
||||
Handle<Object> argv[] = { exec_state, id_object };
|
||||
|
||||
return MakeJSObject(CStrVector("MakeScriptCollectedEvent"),
|
||||
@ -2794,8 +2804,10 @@ void Debugger::OnAfterCompile(Handle<Script> script,
|
||||
isolate_->factory()->LookupOneByteSymbol(
|
||||
STATIC_ASCII_VECTOR("UpdateScriptBreakPoints"));
|
||||
Handle<Object> update_script_break_points =
|
||||
Handle<Object>(debug->debug_context()->global_object()->
|
||||
GetPropertyNoExceptionThrown(*update_script_break_points_symbol));
|
||||
Handle<Object>(
|
||||
debug->debug_context()->global_object()->GetPropertyNoExceptionThrown(
|
||||
*update_script_break_points_symbol),
|
||||
isolate_);
|
||||
if (!update_script_break_points->IsJSFunction()) {
|
||||
return;
|
||||
}
|
||||
@ -2945,7 +2957,7 @@ void Debugger::CallJSEventCallback(v8::DebugEvent event,
|
||||
Handle<JSFunction> fun(Handle<JSFunction>::cast(event_listener_));
|
||||
|
||||
// Invoke the JavaScript debug event listener.
|
||||
Handle<Object> argv[] = { Handle<Object>(Smi::FromInt(event)),
|
||||
Handle<Object> argv[] = { Handle<Object>(Smi::FromInt(event), isolate_),
|
||||
exec_state,
|
||||
event_data,
|
||||
event_listener_data_ };
|
||||
@ -3328,7 +3340,8 @@ Handle<Object> Debugger::Call(Handle<JSFunction> fun,
|
||||
Handle<Object> argv[] = { exec_state, data };
|
||||
Handle<Object> result = Execution::Call(
|
||||
fun,
|
||||
Handle<Object>(isolate_->debug()->debug_context_->global_proxy()),
|
||||
Handle<Object>(isolate_->debug()->debug_context_->global_proxy(),
|
||||
isolate_),
|
||||
ARRAY_SIZE(argv),
|
||||
argv,
|
||||
pending_exception);
|
||||
|
@ -826,7 +826,8 @@ void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) {
|
||||
// Handlify all argument object values before triggering any allocation.
|
||||
List<Handle<Object> > values(deferred_arguments_objects_values_.length());
|
||||
for (int i = 0; i < deferred_arguments_objects_values_.length(); ++i) {
|
||||
values.Add(Handle<Object>(deferred_arguments_objects_values_[i]));
|
||||
values.Add(Handle<Object>(deferred_arguments_objects_values_[i],
|
||||
isolate_));
|
||||
}
|
||||
|
||||
// Play it safe and clear all unhandlified values before we continue.
|
||||
@ -2006,7 +2007,8 @@ SlotRef SlotRef::ComputeSlotForNextArgument(TranslationIterator* iterator,
|
||||
|
||||
case Translation::LITERAL: {
|
||||
int literal_index = iterator->Next();
|
||||
return SlotRef(data->LiteralArray()->get(literal_index));
|
||||
return SlotRef(data->GetIsolate(),
|
||||
data->LiteralArray()->get(literal_index));
|
||||
}
|
||||
|
||||
case Translation::COMPILED_STUB_FRAME:
|
||||
|
@ -733,36 +733,35 @@ class SlotRef BASE_EMBEDDED {
|
||||
SlotRef(Address addr, SlotRepresentation representation)
|
||||
: addr_(addr), representation_(representation) { }
|
||||
|
||||
explicit SlotRef(Object* literal)
|
||||
: literal_(literal), representation_(LITERAL) { }
|
||||
SlotRef(Isolate* isolate, Object* literal)
|
||||
: literal_(literal, isolate), representation_(LITERAL) { }
|
||||
|
||||
Handle<Object> GetValue() {
|
||||
Handle<Object> GetValue(Isolate* isolate) {
|
||||
switch (representation_) {
|
||||
case TAGGED:
|
||||
return Handle<Object>(Memory::Object_at(addr_));
|
||||
return Handle<Object>(Memory::Object_at(addr_), isolate);
|
||||
|
||||
case INT32: {
|
||||
int value = Memory::int32_at(addr_);
|
||||
if (Smi::IsValid(value)) {
|
||||
return Handle<Object>(Smi::FromInt(value));
|
||||
return Handle<Object>(Smi::FromInt(value), isolate);
|
||||
} else {
|
||||
return Isolate::Current()->factory()->NewNumberFromInt(value);
|
||||
return isolate->factory()->NewNumberFromInt(value);
|
||||
}
|
||||
}
|
||||
|
||||
case UINT32: {
|
||||
uint32_t value = Memory::uint32_at(addr_);
|
||||
if (value <= static_cast<uint32_t>(Smi::kMaxValue)) {
|
||||
return Handle<Object>(Smi::FromInt(static_cast<int>(value)));
|
||||
return Handle<Object>(Smi::FromInt(static_cast<int>(value)), isolate);
|
||||
} else {
|
||||
return Isolate::Current()->factory()->NewNumber(
|
||||
static_cast<double>(value));
|
||||
return isolate->factory()->NewNumber(static_cast<double>(value));
|
||||
}
|
||||
}
|
||||
|
||||
case DOUBLE: {
|
||||
double value = Memory::double_at(addr_);
|
||||
return Isolate::Current()->factory()->NewNumber(value);
|
||||
return isolate->factory()->NewNumber(value);
|
||||
}
|
||||
|
||||
case LITERAL:
|
||||
|
@ -111,11 +111,12 @@ static void DumpBuffer(FILE* f, StringBuilder* out) {
|
||||
static const int kOutBufferSize = 2048 + String::kMaxShortPrintLength;
|
||||
static const int kRelocInfoPosition = 57;
|
||||
|
||||
static int DecodeIt(FILE* f,
|
||||
static int DecodeIt(Isolate* isolate,
|
||||
FILE* f,
|
||||
const V8NameConverter& converter,
|
||||
byte* begin,
|
||||
byte* end) {
|
||||
NoHandleAllocation ha;
|
||||
NoHandleAllocation ha(isolate);
|
||||
AssertNoAllocation no_alloc;
|
||||
ExternalReferenceEncoder ref_encoder;
|
||||
Heap* heap = HEAP;
|
||||
@ -282,7 +283,7 @@ static int DecodeIt(FILE* f,
|
||||
out.AddFormatted(" (id = %d)", static_cast<int>(relocinfo.data()));
|
||||
}
|
||||
} else if (rmode == RelocInfo::RUNTIME_ENTRY &&
|
||||
Isolate::Current()->deoptimizer_data() != NULL) {
|
||||
isolate->deoptimizer_data() != NULL) {
|
||||
// A runtime entry reloinfo might be a deoptimization bailout.
|
||||
Address addr = relocinfo.target_address();
|
||||
int id = Deoptimizer::GetDeoptimizationId(addr, Deoptimizer::EAGER);
|
||||
@ -319,14 +320,15 @@ static int DecodeIt(FILE* f,
|
||||
}
|
||||
|
||||
|
||||
int Disassembler::Decode(FILE* f, byte* begin, byte* end) {
|
||||
int Disassembler::Decode(Isolate* isolate, FILE* f, byte* begin, byte* end) {
|
||||
V8NameConverter defaultConverter(NULL);
|
||||
return DecodeIt(f, defaultConverter, begin, end);
|
||||
return DecodeIt(isolate, f, defaultConverter, begin, end);
|
||||
}
|
||||
|
||||
|
||||
// Called by Code::CodePrint.
|
||||
void Disassembler::Decode(FILE* f, Code* code) {
|
||||
Isolate* isolate = code->GetIsolate();
|
||||
int decode_size = (code->kind() == Code::OPTIMIZED_FUNCTION ||
|
||||
code->kind() == Code::COMPILED_STUB)
|
||||
? static_cast<int>(code->safepoint_table_offset())
|
||||
@ -340,13 +342,15 @@ void Disassembler::Decode(FILE* f, Code* code) {
|
||||
byte* begin = code->instruction_start();
|
||||
byte* end = begin + decode_size;
|
||||
V8NameConverter v8NameConverter(code);
|
||||
DecodeIt(f, v8NameConverter, begin, end);
|
||||
DecodeIt(isolate, f, v8NameConverter, begin, end);
|
||||
}
|
||||
|
||||
#else // ENABLE_DISASSEMBLER
|
||||
|
||||
void Disassembler::Dump(FILE* f, byte* begin, byte* end) {}
|
||||
int Disassembler::Decode(FILE* f, byte* begin, byte* end) { return 0; }
|
||||
int Disassembler::Decode(Isolate* isolate, FILE* f, byte* begin, byte* end) {
|
||||
return 0;
|
||||
}
|
||||
void Disassembler::Decode(FILE* f, Code* code) {}
|
||||
|
||||
#endif // ENABLE_DISASSEMBLER
|
||||
|
@ -41,7 +41,7 @@ class Disassembler : public AllStatic {
|
||||
// Decode instructions in the the interval [begin, end) and print the
|
||||
// code into f. Returns the number of bytes disassembled or 1 if no
|
||||
// instruction could be decoded.
|
||||
static int Decode(FILE* f, byte* begin, byte* end);
|
||||
static int Decode(Isolate* isolate, FILE* f, byte* begin, byte* end);
|
||||
|
||||
// Decode instructions in code.
|
||||
static void Decode(FILE* f, Code* code);
|
||||
|
@ -1576,7 +1576,7 @@ class DictionaryElementsAccessor
|
||||
if (mode == JSObject::STRICT_DELETION) {
|
||||
// Deleting a non-configurable property in strict mode.
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> holder(obj);
|
||||
Handle<Object> holder(obj, isolate);
|
||||
Handle<Object> name = isolate->factory()->NewNumberFromUint(key);
|
||||
Handle<Object> args[2] = { name, holder };
|
||||
Handle<Object> error =
|
||||
|
@ -106,7 +106,7 @@ static Handle<Object> Invoke(bool is_construct,
|
||||
// Save and restore context around invocation and block the
|
||||
// allocation of handles without explicit handle scopes.
|
||||
SaveContext save(isolate);
|
||||
NoHandleAllocation na;
|
||||
NoHandleAllocation na(isolate);
|
||||
JSEntryFunction stub_entry = FUNCTION_CAST<JSEntryFunction>(code->entry());
|
||||
|
||||
// Call the function through the right JS entry stub.
|
||||
@ -124,7 +124,7 @@ static Handle<Object> Invoke(bool is_construct,
|
||||
|
||||
// Update the pending exception flag and return the value.
|
||||
*has_pending_exception = value->IsException();
|
||||
ASSERT(*has_pending_exception == Isolate::Current()->has_pending_exception());
|
||||
ASSERT(*has_pending_exception == isolate->has_pending_exception());
|
||||
if (*has_pending_exception) {
|
||||
isolate->ReportPendingMessages();
|
||||
if (isolate->pending_exception()->IsOutOfMemory()) {
|
||||
@ -169,7 +169,9 @@ Handle<Object> Execution::Call(Handle<Object> callable,
|
||||
// Under some circumstances, 'global' can be the JSBuiltinsObject
|
||||
// In that case, don't rewrite. (FWIW, the same holds for
|
||||
// GetIsolate()->global_object()->global_receiver().)
|
||||
if (!global->IsJSBuiltinsObject()) receiver = Handle<Object>(global);
|
||||
if (!global->IsJSBuiltinsObject()) {
|
||||
receiver = Handle<Object>(global, func->GetIsolate());
|
||||
}
|
||||
} else {
|
||||
receiver = ToObject(receiver, pending_exception);
|
||||
}
|
||||
@ -184,7 +186,7 @@ Handle<Object> Execution::New(Handle<JSFunction> func,
|
||||
int argc,
|
||||
Handle<Object> argv[],
|
||||
bool* pending_exception) {
|
||||
return Invoke(true, func, Isolate::Current()->global_object(), argc, argv,
|
||||
return Invoke(true, func, func->GetIsolate()->global_object(), argc, argv,
|
||||
pending_exception);
|
||||
}
|
||||
|
||||
@ -206,9 +208,9 @@ Handle<Object> Execution::TryCall(Handle<JSFunction> func,
|
||||
Handle<Object> result = Invoke(false, func, receiver, argc, args,
|
||||
caught_exception);
|
||||
|
||||
Isolate* isolate = func->GetIsolate();
|
||||
if (*caught_exception) {
|
||||
ASSERT(catcher.HasCaught());
|
||||
Isolate* isolate = Isolate::Current();
|
||||
ASSERT(isolate->has_pending_exception());
|
||||
ASSERT(isolate->external_caught_exception());
|
||||
if (isolate->is_out_of_memory() && !isolate->ignore_out_of_memory()) {
|
||||
@ -223,8 +225,8 @@ Handle<Object> Execution::TryCall(Handle<JSFunction> func,
|
||||
isolate->OptionalRescheduleException(true);
|
||||
}
|
||||
|
||||
ASSERT(!Isolate::Current()->has_pending_exception());
|
||||
ASSERT(!Isolate::Current()->external_caught_exception());
|
||||
ASSERT(!isolate->has_pending_exception());
|
||||
ASSERT(!isolate->external_caught_exception());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -242,7 +244,7 @@ Handle<Object> Execution::GetFunctionDelegate(Handle<Object> object) {
|
||||
while (fun->IsJSFunctionProxy()) {
|
||||
fun = JSFunctionProxy::cast(fun)->call_trap();
|
||||
}
|
||||
if (fun->IsJSFunction()) return Handle<Object>(fun);
|
||||
if (fun->IsJSFunction()) return Handle<Object>(fun, isolate);
|
||||
|
||||
// Objects created through the API can have an instance-call handler
|
||||
// that should be used when calling the object as a function.
|
||||
@ -266,7 +268,7 @@ Handle<Object> Execution::TryGetFunctionDelegate(Handle<Object> object,
|
||||
while (fun->IsJSFunctionProxy()) {
|
||||
fun = JSFunctionProxy::cast(fun)->call_trap();
|
||||
}
|
||||
if (fun->IsJSFunction()) return Handle<Object>(fun);
|
||||
if (fun->IsJSFunction()) return Handle<Object>(fun, isolate);
|
||||
|
||||
// Objects created through the API can have an instance-call handler
|
||||
// that should be used when calling the object as a function.
|
||||
@ -299,7 +301,7 @@ Handle<Object> Execution::GetConstructorDelegate(Handle<Object> object) {
|
||||
while (fun->IsJSFunctionProxy()) {
|
||||
fun = JSFunctionProxy::cast(fun)->call_trap();
|
||||
}
|
||||
if (fun->IsJSFunction()) return Handle<Object>(fun);
|
||||
if (fun->IsJSFunction()) return Handle<Object>(fun, isolate);
|
||||
|
||||
// Objects created through the API can have an instance-call handler
|
||||
// that should be used when calling the object as a function.
|
||||
@ -327,7 +329,7 @@ Handle<Object> Execution::TryGetConstructorDelegate(
|
||||
while (fun->IsJSFunctionProxy()) {
|
||||
fun = JSFunctionProxy::cast(fun)->call_trap();
|
||||
}
|
||||
if (fun->IsJSFunction()) return Handle<Object>(fun);
|
||||
if (fun->IsJSFunction()) return Handle<Object>(fun, isolate);
|
||||
|
||||
// Objects created through the API can have an instance-call handler
|
||||
// that should be used when calling the object as a function.
|
||||
@ -599,7 +601,7 @@ void StackGuard::InitThread(const ExecutionAccess& lock) {
|
||||
} while (false)
|
||||
|
||||
|
||||
Handle<Object> Execution::ToBoolean(Handle<Object> obj) {
|
||||
Handle<Object> Execution::ToBoolean(Isolate* isolate, Handle<Object> obj) {
|
||||
// See the similar code in runtime.js:ToBoolean.
|
||||
if (obj->IsBoolean()) return obj;
|
||||
bool result = true;
|
||||
@ -611,7 +613,7 @@ Handle<Object> Execution::ToBoolean(Handle<Object> obj) {
|
||||
double value = obj->Number();
|
||||
result = !((value == 0) || isnan(value));
|
||||
}
|
||||
return Handle<Object>(HEAP->ToBoolean(result));
|
||||
return Handle<Object>(isolate->heap()->ToBoolean(result), isolate);
|
||||
}
|
||||
|
||||
|
||||
@ -682,7 +684,8 @@ Handle<Object> Execution::CharAt(Handle<String> string, uint32_t index) {
|
||||
}
|
||||
|
||||
Handle<Object> char_at =
|
||||
GetProperty(isolate->js_builtins_object(),
|
||||
GetProperty(isolate,
|
||||
isolate->js_builtins_object(),
|
||||
factory->char_at_symbol());
|
||||
if (!char_at->IsJSFunction()) {
|
||||
return factory->undefined_value();
|
||||
|
@ -92,7 +92,7 @@ class Execution : public AllStatic {
|
||||
bool* caught_exception);
|
||||
|
||||
// ECMA-262 9.2
|
||||
static Handle<Object> ToBoolean(Handle<Object> obj);
|
||||
static Handle<Object> ToBoolean(Isolate* isolate, Handle<Object> obj);
|
||||
|
||||
// ECMA-262 9.3
|
||||
static Handle<Object> ToNumber(Handle<Object> obj, bool* exc);
|
||||
|
@ -753,7 +753,8 @@ Handle<Object> Factory::NewError(const char* maker,
|
||||
Handle<JSArray> args) {
|
||||
Handle<String> make_str = LookupUtf8Symbol(maker);
|
||||
Handle<Object> fun_obj(
|
||||
isolate()->js_builtins_object()->GetPropertyNoExceptionThrown(*make_str));
|
||||
isolate()->js_builtins_object()->GetPropertyNoExceptionThrown(*make_str),
|
||||
isolate());
|
||||
// If the builtins haven't been properly configured yet this error
|
||||
// constructor may not have been defined. Bail out.
|
||||
if (!fun_obj->IsJSFunction()) {
|
||||
@ -1275,7 +1276,7 @@ Handle<JSFunction> Factory::CreateApiFunction(
|
||||
result->shared()->set_length(obj->length());
|
||||
|
||||
// Set class name.
|
||||
Handle<Object> class_name = Handle<Object>(obj->class_name());
|
||||
Handle<Object> class_name = Handle<Object>(obj->class_name(), isolate());
|
||||
if (class_name->IsString()) {
|
||||
result->shared()->set_instance_class_name(*class_name);
|
||||
result->shared()->set_name(*class_name);
|
||||
@ -1321,7 +1322,7 @@ Handle<JSFunction> Factory::CreateApiFunction(
|
||||
while (true) {
|
||||
Object* props = info->property_accessors();
|
||||
if (!props->IsUndefined()) {
|
||||
Handle<Object> props_handle(props);
|
||||
Handle<Object> props_handle(props, isolate());
|
||||
NeanderArray props_array(props_handle);
|
||||
max_number_of_additional_properties += props_array.length();
|
||||
}
|
||||
@ -1333,11 +1334,12 @@ Handle<JSFunction> Factory::CreateApiFunction(
|
||||
Map::EnsureDescriptorSlack(map, max_number_of_additional_properties);
|
||||
|
||||
while (true) {
|
||||
Handle<Object> props = Handle<Object>(obj->property_accessors());
|
||||
Handle<Object> props = Handle<Object>(obj->property_accessors(),
|
||||
isolate());
|
||||
if (!props->IsUndefined()) {
|
||||
Map::AppendCallbackDescriptors(map, props);
|
||||
}
|
||||
Handle<Object> parent = Handle<Object>(obj->parent_template());
|
||||
Handle<Object> parent = Handle<Object>(obj->parent_template(), isolate());
|
||||
if (parent->IsUndefined()) break;
|
||||
obj = Handle<FunctionTemplateInfo>::cast(parent);
|
||||
}
|
||||
@ -1457,9 +1459,7 @@ Handle<Object> Factory::GlobalConstantFor(Handle<String> name) {
|
||||
|
||||
|
||||
Handle<Object> Factory::ToBoolean(bool value) {
|
||||
return Handle<Object>(value
|
||||
? isolate()->heap()->true_value()
|
||||
: isolate()->heap()->false_value());
|
||||
return value ? true_value() : false_value();
|
||||
}
|
||||
|
||||
|
||||
|
@ -485,7 +485,7 @@ class FrameSummary BASE_EMBEDDED {
|
||||
Code* code,
|
||||
int offset,
|
||||
bool is_constructor)
|
||||
: receiver_(receiver),
|
||||
: receiver_(receiver, function->GetIsolate()),
|
||||
function_(function),
|
||||
code_(code),
|
||||
offset_(offset),
|
||||
|
@ -37,25 +37,17 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
inline Isolate* GetIsolateForHandle(Object* obj) {
|
||||
return Isolate::Current();
|
||||
}
|
||||
|
||||
inline Isolate* GetIsolateForHandle(HeapObject* obj) {
|
||||
return obj->GetIsolate();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Handle<T>::Handle(T* obj) {
|
||||
ASSERT(!obj->IsFailure());
|
||||
location_ = HandleScope::CreateHandle(obj, GetIsolateForHandle(obj));
|
||||
location_ = HandleScope::CreateHandle(obj->GetIsolate(), obj);
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
Handle<T>::Handle(T* obj, Isolate* isolate) {
|
||||
ASSERT(!obj->IsFailure());
|
||||
location_ = HandleScope::CreateHandle(obj, isolate);
|
||||
location_ = HandleScope::CreateHandle(isolate, obj);
|
||||
}
|
||||
|
||||
|
||||
@ -77,7 +69,6 @@ inline T** Handle<T>::location() const {
|
||||
|
||||
|
||||
HandleScope::HandleScope(Isolate* isolate) {
|
||||
ASSERT(isolate == Isolate::Current());
|
||||
v8::ImplementationUtilities::HandleScopeData* current =
|
||||
isolate->handle_scope_data();
|
||||
isolate_ = isolate;
|
||||
@ -92,7 +83,6 @@ HandleScope::~HandleScope() {
|
||||
}
|
||||
|
||||
void HandleScope::CloseScope() {
|
||||
ASSERT(isolate_ == Isolate::Current());
|
||||
v8::ImplementationUtilities::HandleScopeData* current =
|
||||
isolate_->handle_scope_data();
|
||||
current->next = prev_next_;
|
||||
@ -116,7 +106,7 @@ Handle<T> HandleScope::CloseAndEscape(Handle<T> handle_value) {
|
||||
isolate_->handle_scope_data();
|
||||
// Allocate one handle in the parent scope.
|
||||
ASSERT(current->level > 0);
|
||||
Handle<T> result(CreateHandle<T>(value, isolate_));
|
||||
Handle<T> result(CreateHandle<T>(isolate_, value));
|
||||
// Reinitialize the current scope (so that it's ready
|
||||
// to be used or closed again).
|
||||
prev_next_ = current->next;
|
||||
@ -127,13 +117,12 @@ Handle<T> HandleScope::CloseAndEscape(Handle<T> handle_value) {
|
||||
|
||||
|
||||
template <typename T>
|
||||
T** HandleScope::CreateHandle(T* value, Isolate* isolate) {
|
||||
ASSERT(isolate == Isolate::Current());
|
||||
T** HandleScope::CreateHandle(Isolate* isolate, T* value) {
|
||||
v8::ImplementationUtilities::HandleScopeData* current =
|
||||
isolate->handle_scope_data();
|
||||
|
||||
internal::Object** cur = current->next;
|
||||
if (cur == current->limit) cur = Extend();
|
||||
if (cur == current->limit) cur = Extend(isolate);
|
||||
// Update the current next field, set the value in the created
|
||||
// handle, and return the result.
|
||||
ASSERT(cur < current->limit);
|
||||
@ -146,10 +135,10 @@ T** HandleScope::CreateHandle(T* value, Isolate* isolate) {
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
inline NoHandleAllocation::NoHandleAllocation() {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
inline NoHandleAllocation::NoHandleAllocation(Isolate* isolate)
|
||||
: isolate_(isolate) {
|
||||
v8::ImplementationUtilities::HandleScopeData* current =
|
||||
isolate->handle_scope_data();
|
||||
isolate_->handle_scope_data();
|
||||
|
||||
active_ = !isolate->optimizing_compiler_thread()->IsOptimizerThread();
|
||||
if (active_) {
|
||||
@ -168,42 +157,42 @@ inline NoHandleAllocation::~NoHandleAllocation() {
|
||||
// Restore state in current handle scope to re-enable handle
|
||||
// allocations.
|
||||
v8::ImplementationUtilities::HandleScopeData* data =
|
||||
Isolate::Current()->handle_scope_data();
|
||||
isolate_->handle_scope_data();
|
||||
ASSERT_EQ(0, data->level);
|
||||
data->level = level_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NoHandleDereference::NoHandleDereference() {
|
||||
NoHandleDereference::NoHandleDereference(Isolate* isolate)
|
||||
: isolate_(isolate) {
|
||||
// The guard is set on a per-isolate basis, so it affects all threads.
|
||||
// That's why we can only use it when running without parallel recompilation.
|
||||
if (FLAG_parallel_recompilation) return;
|
||||
Isolate* isolate = Isolate::Current();
|
||||
old_state_ = isolate->allow_handle_deref();
|
||||
isolate->set_allow_handle_deref(false);
|
||||
isolate_->set_allow_handle_deref(false);
|
||||
}
|
||||
|
||||
|
||||
NoHandleDereference::~NoHandleDereference() {
|
||||
if (FLAG_parallel_recompilation) return;
|
||||
Isolate::Current()->set_allow_handle_deref(old_state_);
|
||||
isolate_->set_allow_handle_deref(old_state_);
|
||||
}
|
||||
|
||||
|
||||
AllowHandleDereference::AllowHandleDereference() {
|
||||
AllowHandleDereference::AllowHandleDereference(Isolate* isolate)
|
||||
: isolate_(isolate) {
|
||||
// The guard is set on a per-isolate basis, so it affects all threads.
|
||||
// That's why we can only use it when running without parallel recompilation.
|
||||
if (FLAG_parallel_recompilation) return;
|
||||
Isolate* isolate = Isolate::Current();
|
||||
old_state_ = isolate->allow_handle_deref();
|
||||
isolate->set_allow_handle_deref(true);
|
||||
isolate_->set_allow_handle_deref(true);
|
||||
}
|
||||
|
||||
|
||||
AllowHandleDereference::~AllowHandleDereference() {
|
||||
if (FLAG_parallel_recompilation) return;
|
||||
Isolate::Current()->set_allow_handle_deref(old_state_);
|
||||
isolate_->set_allow_handle_deref(old_state_);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -45,8 +45,7 @@ namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
|
||||
int HandleScope::NumberOfHandles() {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
int HandleScope::NumberOfHandles(Isolate* isolate) {
|
||||
HandleScopeImplementer* impl = isolate->handle_scope_implementer();
|
||||
int n = impl->blocks()->length();
|
||||
if (n == 0) return 0;
|
||||
@ -55,8 +54,7 @@ int HandleScope::NumberOfHandles() {
|
||||
}
|
||||
|
||||
|
||||
Object** HandleScope::Extend() {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Object** HandleScope::Extend(Isolate* isolate) {
|
||||
v8::ImplementationUtilities::HandleScopeData* current =
|
||||
isolate->handle_scope_data();
|
||||
|
||||
@ -97,7 +95,6 @@ Object** HandleScope::Extend() {
|
||||
|
||||
|
||||
void HandleScope::DeleteExtensions(Isolate* isolate) {
|
||||
ASSERT(isolate == Isolate::Current());
|
||||
v8::ImplementationUtilities::HandleScopeData* current =
|
||||
isolate->handle_scope_data();
|
||||
isolate->handle_scope_implementer()->DeleteExtensions(current->limit);
|
||||
@ -112,21 +109,18 @@ void HandleScope::ZapRange(Object** start, Object** end) {
|
||||
}
|
||||
|
||||
|
||||
Address HandleScope::current_level_address() {
|
||||
return reinterpret_cast<Address>(
|
||||
&Isolate::Current()->handle_scope_data()->level);
|
||||
Address HandleScope::current_level_address(Isolate* isolate) {
|
||||
return reinterpret_cast<Address>(&isolate->handle_scope_data()->level);
|
||||
}
|
||||
|
||||
|
||||
Address HandleScope::current_next_address() {
|
||||
return reinterpret_cast<Address>(
|
||||
&Isolate::Current()->handle_scope_data()->next);
|
||||
Address HandleScope::current_next_address(Isolate* isolate) {
|
||||
return reinterpret_cast<Address>(&isolate->handle_scope_data()->next);
|
||||
}
|
||||
|
||||
|
||||
Address HandleScope::current_limit_address() {
|
||||
return reinterpret_cast<Address>(
|
||||
&Isolate::Current()->handle_scope_data()->limit);
|
||||
Address HandleScope::current_limit_address(Isolate* isolate) {
|
||||
return reinterpret_cast<Address>(&isolate->handle_scope_data()->limit);
|
||||
}
|
||||
|
||||
|
||||
@ -287,9 +281,9 @@ Handle<Object> GetProperty(Handle<JSReceiver> obj,
|
||||
}
|
||||
|
||||
|
||||
Handle<Object> GetProperty(Handle<Object> obj,
|
||||
Handle<Object> GetProperty(Isolate* isolate,
|
||||
Handle<Object> obj,
|
||||
Handle<Object> key) {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
CALL_HEAP_FUNCTION(isolate,
|
||||
Runtime::GetObjectProperty(isolate, obj, key), Object);
|
||||
}
|
||||
@ -315,8 +309,8 @@ Handle<Object> SetPrototype(Handle<JSObject> obj, Handle<Object> value) {
|
||||
}
|
||||
|
||||
|
||||
Handle<Object> LookupSingleCharacterStringFromCode(uint32_t index) {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Handle<Object> LookupSingleCharacterStringFromCode(Isolate* isolate,
|
||||
uint32_t index) {
|
||||
CALL_HEAP_FUNCTION(
|
||||
isolate,
|
||||
isolate->heap()->LookupSingleCharacterStringFromCode(index), Object);
|
||||
@ -371,7 +365,7 @@ Handle<JSValue> GetScriptWrapper(Handle<Script> script) {
|
||||
return Handle<JSValue>(
|
||||
reinterpret_cast<JSValue**>(script->wrapper()->foreign_address()));
|
||||
}
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Isolate* isolate = script->GetIsolate();
|
||||
// Construct a new script wrapper.
|
||||
isolate->counters()->script_wrappers()->Increment();
|
||||
Handle<JSFunction> constructor = isolate->script_function();
|
||||
@ -612,7 +606,8 @@ Handle<Object> GetScriptNameOrSourceURL(Handle<Script> script) {
|
||||
isolate->factory()->LookupOneByteSymbol(
|
||||
STATIC_ASCII_VECTOR("nameOrSourceURL"));
|
||||
Handle<JSValue> script_wrapper = GetScriptWrapper(script);
|
||||
Handle<Object> property = GetProperty(script_wrapper,
|
||||
Handle<Object> property = GetProperty(isolate,
|
||||
script_wrapper,
|
||||
name_or_source_url_key);
|
||||
ASSERT(property->IsJSFunction());
|
||||
Handle<JSFunction> method = Handle<JSFunction>::cast(property);
|
||||
@ -898,7 +893,6 @@ Handle<ObjectHashTable> PutIntoObjectHashTable(Handle<ObjectHashTable> table,
|
||||
|
||||
DeferredHandleScope::DeferredHandleScope(Isolate* isolate)
|
||||
: impl_(isolate->handle_scope_implementer()) {
|
||||
ASSERT(impl_->isolate() == Isolate::Current());
|
||||
impl_->BeginDeferredScope();
|
||||
v8::ImplementationUtilities::HandleScopeData* data =
|
||||
impl_->isolate()->handle_scope_data();
|
||||
|
@ -124,18 +124,18 @@ class HandleScope {
|
||||
inline ~HandleScope();
|
||||
|
||||
// Counts the number of allocated handles.
|
||||
static int NumberOfHandles();
|
||||
static int NumberOfHandles(Isolate* isolate);
|
||||
|
||||
// Creates a new handle with the given value.
|
||||
template <typename T>
|
||||
static inline T** CreateHandle(T* value, Isolate* isolate);
|
||||
static inline T** CreateHandle(Isolate* isolate, T* value);
|
||||
|
||||
// Deallocates any extensions used by the current scope.
|
||||
static void DeleteExtensions(Isolate* isolate);
|
||||
|
||||
static Address current_next_address();
|
||||
static Address current_limit_address();
|
||||
static Address current_level_address();
|
||||
static Address current_next_address(Isolate* isolate);
|
||||
static Address current_limit_address(Isolate* isolate);
|
||||
static Address current_level_address(Isolate* isolate);
|
||||
|
||||
// Closes the HandleScope (invalidating all handles
|
||||
// created in the scope of the HandleScope) and returns
|
||||
@ -160,7 +160,7 @@ class HandleScope {
|
||||
Object** prev_limit_;
|
||||
|
||||
// Extend the handle scope making room for more handles.
|
||||
static internal::Object** Extend();
|
||||
static internal::Object** Extend(Isolate* isolate);
|
||||
|
||||
// Zaps the handles in the half-open interval [start, end).
|
||||
static void ZapRange(internal::Object** start, internal::Object** end);
|
||||
@ -230,7 +230,8 @@ Handle<Object> ForceDeleteProperty(Handle<JSObject> object,
|
||||
Handle<Object> GetProperty(Handle<JSReceiver> obj,
|
||||
const char* name);
|
||||
|
||||
Handle<Object> GetProperty(Handle<Object> obj,
|
||||
Handle<Object> GetProperty(Isolate* isolate,
|
||||
Handle<Object> obj,
|
||||
Handle<Object> key);
|
||||
|
||||
Handle<Object> GetPropertyWithInterceptor(Handle<JSObject> receiver,
|
||||
@ -240,7 +241,8 @@ Handle<Object> GetPropertyWithInterceptor(Handle<JSObject> receiver,
|
||||
|
||||
Handle<Object> SetPrototype(Handle<JSObject> obj, Handle<Object> value);
|
||||
|
||||
Handle<Object> LookupSingleCharacterStringFromCode(uint32_t index);
|
||||
Handle<Object> LookupSingleCharacterStringFromCode(Isolate* isolate,
|
||||
uint32_t index);
|
||||
|
||||
Handle<JSObject> Copy(Handle<JSObject> obj);
|
||||
|
||||
@ -326,12 +328,13 @@ Handle<ObjectHashTable> PutIntoObjectHashTable(Handle<ObjectHashTable> table,
|
||||
class NoHandleAllocation BASE_EMBEDDED {
|
||||
public:
|
||||
#ifndef DEBUG
|
||||
NoHandleAllocation() {}
|
||||
explicit NoHandleAllocation(Isolate* isolate) {}
|
||||
~NoHandleAllocation() {}
|
||||
#else
|
||||
inline NoHandleAllocation();
|
||||
explicit inline NoHandleAllocation(Isolate* isolate);
|
||||
inline ~NoHandleAllocation();
|
||||
private:
|
||||
Isolate* isolate_;
|
||||
int level_;
|
||||
bool active_;
|
||||
#endif
|
||||
@ -341,12 +344,13 @@ class NoHandleAllocation BASE_EMBEDDED {
|
||||
class NoHandleDereference BASE_EMBEDDED {
|
||||
public:
|
||||
#ifndef DEBUG
|
||||
NoHandleDereference() {}
|
||||
explicit NoHandleDereference(Isolate* isolate) {}
|
||||
~NoHandleDereference() {}
|
||||
#else
|
||||
inline NoHandleDereference();
|
||||
explicit inline NoHandleDereference(Isolate* isolate);
|
||||
inline ~NoHandleDereference();
|
||||
private:
|
||||
Isolate* isolate_;
|
||||
bool old_state_;
|
||||
#endif
|
||||
};
|
||||
@ -355,12 +359,13 @@ class NoHandleDereference BASE_EMBEDDED {
|
||||
class AllowHandleDereference BASE_EMBEDDED {
|
||||
public:
|
||||
#ifndef DEBUG
|
||||
AllowHandleDereference() {}
|
||||
explicit AllowHandleDereference(Isolate* isolate) {}
|
||||
~AllowHandleDereference() {}
|
||||
#else
|
||||
inline AllowHandleDereference();
|
||||
explicit inline AllowHandleDereference(Isolate* isolate);
|
||||
inline ~AllowHandleDereference();
|
||||
private:
|
||||
Isolate* isolate_;
|
||||
bool old_state_;
|
||||
#endif
|
||||
};
|
||||
|
@ -5571,7 +5571,7 @@ void Heap::ReportHeapStatistics(const char* title) {
|
||||
PrintF("old_gen_limit_factor_ %d\n", old_gen_limit_factor_);
|
||||
|
||||
PrintF("\n");
|
||||
PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles());
|
||||
PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles(isolate_));
|
||||
isolate_->global_handles()->PrintStats();
|
||||
PrintF("\n");
|
||||
|
||||
|
@ -76,6 +76,12 @@ int HValue::LoopWeight() const {
|
||||
}
|
||||
|
||||
|
||||
Isolate* HValue::isolate() const {
|
||||
ASSERT(block() != NULL);
|
||||
return block()->graph()->isolate();
|
||||
}
|
||||
|
||||
|
||||
void HValue::AssumeRepresentation(Representation r) {
|
||||
if (CheckFlag(kFlexibleRepresentation)) {
|
||||
ChangeRepresentation(r);
|
||||
@ -342,10 +348,10 @@ const char* HType::ToString() {
|
||||
}
|
||||
|
||||
|
||||
HType HType::TypeFromValue(Handle<Object> value) {
|
||||
HType HType::TypeFromValue(Isolate* isolate, Handle<Object> value) {
|
||||
// Handle dereferencing is safe here: an object's type as checked below
|
||||
// never changes.
|
||||
AllowHandleDereference allow_handle_deref;
|
||||
AllowHandleDereference allow_handle_deref(isolate);
|
||||
|
||||
HType result = HType::Tagged();
|
||||
if (value->IsSmi()) {
|
||||
@ -1299,7 +1305,7 @@ HValue* HCheckInstanceType::Canonicalize() {
|
||||
|
||||
if (check_ == IS_SYMBOL && value()->IsConstant()) {
|
||||
// Dereferencing is safe here: a symbol cannot become a non-symbol.
|
||||
AllowHandleDereference allow_handle_deref;
|
||||
AllowHandleDereference allow_handle_deref(isolate());
|
||||
if (HConstant::cast(value())->handle()->IsSymbol()) return NULL;
|
||||
}
|
||||
return this;
|
||||
@ -1805,7 +1811,7 @@ HConstant::HConstant(Handle<Object> handle, Representation r)
|
||||
has_int32_value_(false),
|
||||
has_double_value_(false) {
|
||||
// Dereferencing here is safe: the value of a number object does not change.
|
||||
AllowHandleDereference allow_handle_deref;
|
||||
AllowHandleDereference allow_handle_deref(Isolate::Current());
|
||||
SetFlag(kUseGVN);
|
||||
if (handle_->IsNumber()) {
|
||||
double n = handle_->Number();
|
||||
@ -1886,7 +1892,7 @@ bool HConstant::ToBoolean() {
|
||||
}
|
||||
// Dereferencing is safe: singletons do not change and strings are
|
||||
// immutable.
|
||||
AllowHandleDereference allow_handle_deref;
|
||||
AllowHandleDereference allow_handle_deref(isolate());
|
||||
if (handle_->IsTrue()) return true;
|
||||
if (handle_->IsFalse()) return false;
|
||||
if (handle_->IsUndefined()) return false;
|
||||
@ -2574,7 +2580,7 @@ HType HConstant::CalculateInferredType() {
|
||||
return Smi::IsValid(int32_value_) ? HType::Smi() : HType::HeapNumber();
|
||||
}
|
||||
if (has_double_value_) return HType::HeapNumber();
|
||||
return HType::TypeFromValue(handle_);
|
||||
return HType::TypeFromValue(isolate(), handle_);
|
||||
}
|
||||
|
||||
|
||||
@ -2833,13 +2839,15 @@ HInstruction* HStringCharFromCode::New(
|
||||
Zone* zone, HValue* context, HValue* char_code) {
|
||||
if (FLAG_fold_constants && char_code->IsConstant()) {
|
||||
HConstant* c_code = HConstant::cast(char_code);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
if (c_code->HasNumberValue()) {
|
||||
if (isfinite(c_code->DoubleValue())) {
|
||||
uint32_t code = c_code->NumberValueAsInteger32() & 0xffff;
|
||||
return new(zone) HConstant(LookupSingleCharacterStringFromCode(code),
|
||||
return new(zone) HConstant(LookupSingleCharacterStringFromCode(isolate,
|
||||
code),
|
||||
Representation::Tagged());
|
||||
}
|
||||
return new(zone) HConstant(FACTORY->empty_string(),
|
||||
return new(zone) HConstant(isolate->factory()->empty_string(),
|
||||
Representation::Tagged());
|
||||
}
|
||||
}
|
||||
|
@ -233,11 +233,9 @@ class LChunkBuilder;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#define ASSERT_ALLOCATION_DISABLED do { \
|
||||
OptimizingCompilerThread* thread = \
|
||||
ISOLATE->optimizing_compiler_thread(); \
|
||||
ASSERT(thread->IsOptimizerThread() || !HEAP->IsAllocationAllowed()); \
|
||||
} while (0)
|
||||
#define ASSERT_ALLOCATION_DISABLED \
|
||||
ASSERT(isolate()->optimizing_compiler_thread()->IsOptimizerThread() || \
|
||||
!isolate()->heap()->IsAllocationAllowed())
|
||||
#else
|
||||
#define ASSERT_ALLOCATION_DISABLED do {} while (0)
|
||||
#endif
|
||||
@ -452,7 +450,7 @@ class HType {
|
||||
return IsHeapNumber() || IsString() || IsNonPrimitive();
|
||||
}
|
||||
|
||||
static HType TypeFromValue(Handle<Object> value);
|
||||
static HType TypeFromValue(Isolate* isolate, Handle<Object> value);
|
||||
|
||||
const char* ToString();
|
||||
|
||||
@ -764,6 +762,9 @@ class HValue: public ZoneObject {
|
||||
void SetBlock(HBasicBlock* block);
|
||||
int LoopWeight() const;
|
||||
|
||||
// Note: Never call this method for an unlinked value.
|
||||
Isolate* isolate() const;
|
||||
|
||||
int id() const { return id_; }
|
||||
void set_id(int id) { id_ = id; }
|
||||
|
||||
@ -2766,7 +2767,7 @@ class HCheckPrototypeMaps: public HTemplateInstruction<0> {
|
||||
virtual intptr_t Hashcode() {
|
||||
ASSERT_ALLOCATION_DISABLED;
|
||||
// Dereferencing to use the object's raw address for hashing is safe.
|
||||
AllowHandleDereference allow_handle_deref;
|
||||
AllowHandleDereference allow_handle_deref(isolate());
|
||||
intptr_t hash = 0;
|
||||
for (int i = 0; i < prototypes_.length(); i++) {
|
||||
hash = 17 * hash + reinterpret_cast<intptr_t>(*prototypes_[i]);
|
||||
@ -3070,11 +3071,11 @@ class HConstant: public HTemplateInstruction<0> {
|
||||
}
|
||||
|
||||
ASSERT(!handle_.is_null());
|
||||
Heap* heap = HEAP;
|
||||
Heap* heap = isolate()->heap();
|
||||
// We should have handled minus_zero_value and nan_value in the
|
||||
// has_double_value_ clause above.
|
||||
// Dereferencing is safe to compare against singletons.
|
||||
AllowHandleDereference allow_handle_deref;
|
||||
AllowHandleDereference allow_handle_deref(isolate());
|
||||
ASSERT(*handle_ != heap->minus_zero_value());
|
||||
ASSERT(*handle_ != heap->nan_value());
|
||||
return *handle_ == heap->undefined_value() ||
|
||||
@ -3147,7 +3148,7 @@ class HConstant: public HTemplateInstruction<0> {
|
||||
} else {
|
||||
ASSERT(!handle_.is_null());
|
||||
// Dereferencing to use the object's raw address for hashing is safe.
|
||||
AllowHandleDereference allow_handle_deref;
|
||||
AllowHandleDereference allow_handle_deref(isolate());
|
||||
hash = reinterpret_cast<intptr_t>(*handle_);
|
||||
}
|
||||
|
||||
@ -4478,7 +4479,7 @@ class HLoadGlobalCell: public HTemplateInstruction<0> {
|
||||
virtual intptr_t Hashcode() {
|
||||
ASSERT_ALLOCATION_DISABLED;
|
||||
// Dereferencing to use the object's raw address for hashing is safe.
|
||||
AllowHandleDereference allow_handle_deref;
|
||||
AllowHandleDereference allow_handle_deref(isolate());
|
||||
return reinterpret_cast<intptr_t>(*cell_);
|
||||
}
|
||||
|
||||
|
@ -500,7 +500,7 @@ class ReachabilityAnalyzer BASE_EMBEDDED {
|
||||
|
||||
void HGraph::Verify(bool do_full_verify) const {
|
||||
// Allow dereferencing for debug mode verification.
|
||||
AllowHandleDereference allow_handle_deref;
|
||||
AllowHandleDereference allow_handle_deref(isolate());
|
||||
for (int i = 0; i < blocks_.length(); i++) {
|
||||
HBasicBlock* block = blocks_.at(i);
|
||||
|
||||
@ -953,7 +953,7 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess(
|
||||
AddInstruction(new(zone) HLoadElements(object, mapcheck));
|
||||
if (is_store && (fast_elements || fast_smi_only_elements)) {
|
||||
HCheckMaps* check_cow_map = new(zone) HCheckMaps(
|
||||
elements, Isolate::Current()->factory()->fixed_array_map(), zone);
|
||||
elements, graph()->isolate()->factory()->fixed_array_map(), zone);
|
||||
check_cow_map->ClearGVNFlag(kDependsOnElementsKind);
|
||||
AddInstruction(check_cow_map);
|
||||
}
|
||||
@ -5179,7 +5179,7 @@ void HOptimizedGraphBuilder::VisitForInStatement(ForInStatement* stmt) {
|
||||
HInstruction* enum_length = AddInstruction(new(zone()) HMapEnumLength(map));
|
||||
|
||||
HInstruction* start_index = AddInstruction(new(zone()) HConstant(
|
||||
Handle<Object>(Smi::FromInt(0)), Representation::Integer32()));
|
||||
Handle<Object>(Smi::FromInt(0), isolate()), Representation::Integer32()));
|
||||
|
||||
Push(map);
|
||||
Push(array);
|
||||
@ -5529,12 +5529,13 @@ static bool LookupAccessorPair(Handle<Map> map,
|
||||
Handle<String> name,
|
||||
Handle<AccessorPair>* accessors,
|
||||
Handle<JSObject>* holder) {
|
||||
LookupResult lookup(map->GetIsolate());
|
||||
Isolate* isolate = map->GetIsolate();
|
||||
LookupResult lookup(isolate);
|
||||
|
||||
// Check for a JavaScript accessor directly in the map.
|
||||
map->LookupDescriptor(NULL, *name, &lookup);
|
||||
if (lookup.IsPropertyCallbacks()) {
|
||||
Handle<Object> callback(lookup.GetValueFromMap(*map));
|
||||
Handle<Object> callback(lookup.GetValueFromMap(*map), isolate);
|
||||
if (!callback->IsAccessorPair()) return false;
|
||||
*accessors = Handle<AccessorPair>::cast(callback);
|
||||
*holder = Handle<JSObject>();
|
||||
@ -5547,7 +5548,7 @@ static bool LookupAccessorPair(Handle<Map> map,
|
||||
// Check for a JavaScript accessor somewhere in the proto chain.
|
||||
LookupInPrototypes(map, name, &lookup);
|
||||
if (lookup.IsPropertyCallbacks()) {
|
||||
Handle<Object> callback(lookup.GetValue());
|
||||
Handle<Object> callback(lookup.GetValue(), isolate);
|
||||
if (!callback->IsAccessorPair()) return false;
|
||||
*accessors = Handle<AccessorPair>::cast(callback);
|
||||
*holder = Handle<JSObject>(lookup.holder());
|
||||
@ -5597,9 +5598,10 @@ static bool IsFastLiteral(Handle<JSObject> boilerplate,
|
||||
ASSERT(max_depth >= 0 && *max_properties >= 0);
|
||||
if (max_depth == 0) return false;
|
||||
|
||||
Isolate* isolate = boilerplate->GetIsolate();
|
||||
Handle<FixedArrayBase> elements(boilerplate->elements());
|
||||
if (elements->length() > 0 &&
|
||||
elements->map() != boilerplate->GetHeap()->fixed_cow_array_map()) {
|
||||
elements->map() != isolate->heap()->fixed_cow_array_map()) {
|
||||
if (boilerplate->HasFastDoubleElements()) {
|
||||
*total_size += FixedDoubleArray::SizeFor(elements->length());
|
||||
} else if (boilerplate->HasFastObjectElements()) {
|
||||
@ -5607,7 +5609,7 @@ static bool IsFastLiteral(Handle<JSObject> boilerplate,
|
||||
int length = elements->length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
if ((*max_properties)-- == 0) return false;
|
||||
Handle<Object> value(fast_elements->get(i));
|
||||
Handle<Object> value(fast_elements->get(i), isolate);
|
||||
if (value->IsJSObject()) {
|
||||
Handle<JSObject> value_object = Handle<JSObject>::cast(value);
|
||||
if (!IsFastLiteral(value_object,
|
||||
@ -5631,7 +5633,7 @@ static bool IsFastLiteral(Handle<JSObject> boilerplate,
|
||||
int nof = boilerplate->map()->inobject_properties();
|
||||
for (int i = 0; i < nof; i++) {
|
||||
if ((*max_properties)-- == 0) return false;
|
||||
Handle<Object> value(boilerplate->InObjectPropertyAt(i));
|
||||
Handle<Object> value(boilerplate->InObjectPropertyAt(i), isolate);
|
||||
if (value->IsJSObject()) {
|
||||
Handle<JSObject> value_object = Handle<JSObject>::cast(value);
|
||||
if (!IsFastLiteral(value_object,
|
||||
@ -5660,7 +5662,8 @@ void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
// Check whether to use fast or slow deep-copying for boilerplate.
|
||||
int total_size = 0;
|
||||
int max_properties = HFastLiteral::kMaxLiteralProperties;
|
||||
Handle<Object> boilerplate(closure->literals()->get(expr->literal_index()));
|
||||
Handle<Object> boilerplate(closure->literals()->get(expr->literal_index()),
|
||||
isolate());
|
||||
if (boilerplate->IsJSObject() &&
|
||||
IsFastLiteral(Handle<JSObject>::cast(boilerplate),
|
||||
HFastLiteral::kMaxLiteralDepth,
|
||||
@ -5765,7 +5768,8 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
|
||||
HInstruction* literal;
|
||||
|
||||
Handle<FixedArray> literals(environment()->closure()->literals());
|
||||
Handle<Object> raw_boilerplate(literals->get(expr->literal_index()));
|
||||
Handle<Object> raw_boilerplate(literals->get(expr->literal_index()),
|
||||
isolate());
|
||||
|
||||
if (raw_boilerplate->IsUndefined()) {
|
||||
raw_boilerplate = Runtime::CreateArrayLiteralBoilerplate(
|
||||
@ -5837,7 +5841,7 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
|
||||
AddInstruction(elements);
|
||||
|
||||
HValue* key = AddInstruction(
|
||||
new(zone()) HConstant(Handle<Object>(Smi::FromInt(i)),
|
||||
new(zone()) HConstant(Handle<Object>(Smi::FromInt(i), isolate()),
|
||||
Representation::Integer32()));
|
||||
|
||||
switch (boilerplate_elements_kind) {
|
||||
@ -7097,8 +7101,8 @@ bool HOptimizedGraphBuilder::TryArgumentsAccess(Property* expr) {
|
||||
int argument_count = environment()->
|
||||
arguments_environment()->parameter_count() - 1;
|
||||
result = new(zone()) HConstant(
|
||||
Handle<Object>(Smi::FromInt(argument_count)),
|
||||
Representation::Integer32());
|
||||
Handle<Object>(Smi::FromInt(argument_count), isolate()),
|
||||
Representation::Integer32());
|
||||
}
|
||||
} else {
|
||||
Push(graph()->GetArgumentsObject());
|
||||
@ -7121,8 +7125,8 @@ bool HOptimizedGraphBuilder::TryArgumentsAccess(Property* expr) {
|
||||
int argument_count = environment()->
|
||||
arguments_environment()->parameter_count() - 1;
|
||||
HInstruction* length = AddInstruction(new(zone()) HConstant(
|
||||
Handle<Object>(Smi::FromInt(argument_count)),
|
||||
Representation::Integer32()));
|
||||
Handle<Object>(Smi::FromInt(argument_count), isolate()),
|
||||
Representation::Integer32()));
|
||||
HInstruction* checked_key = AddBoundsCheck(key, length);
|
||||
result = new(zone()) HAccessArgumentsAt(elements, length, checked_key);
|
||||
}
|
||||
@ -7933,7 +7937,8 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
|
||||
HUnaryMathOperation::New(zone(), context, left, kMathPowHalf);
|
||||
} else if (exponent == -0.5) {
|
||||
HConstant* double_one =
|
||||
new(zone()) HConstant(Handle<Object>(Smi::FromInt(1)),
|
||||
new(zone()) HConstant(Handle<Object>(Smi::FromInt(1),
|
||||
isolate()),
|
||||
Representation::Double());
|
||||
AddInstruction(double_one);
|
||||
HInstruction* sqrt =
|
||||
|
@ -250,7 +250,7 @@ class HGraph: public ZoneObject {
|
||||
public:
|
||||
explicit HGraph(CompilationInfo* info);
|
||||
|
||||
Isolate* isolate() { return isolate_; }
|
||||
Isolate* isolate() const { return isolate_; }
|
||||
Zone* zone() const { return zone_; }
|
||||
CompilationInfo* info() const { return info_; }
|
||||
|
||||
|
@ -2487,7 +2487,7 @@ void Assembler::emit_sse_operand(Register dst, XMMRegister src) {
|
||||
|
||||
|
||||
void Assembler::Print() {
|
||||
Disassembler::Decode(stdout, buffer_, pc_);
|
||||
Disassembler::Decode(isolate(), stdout, buffer_, pc_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1112,7 +1112,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
Handle<JSGlobalPropertyCell> cell =
|
||||
isolate()->factory()->NewJSGlobalPropertyCell(
|
||||
Handle<Object>(
|
||||
Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker)));
|
||||
Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker),
|
||||
isolate()));
|
||||
RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell);
|
||||
__ LoadHeapObject(ebx, cell);
|
||||
__ mov(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset),
|
||||
|
@ -5611,7 +5611,8 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
|
||||
// Copy in-object properties.
|
||||
for (int i = 0; i < inobject_properties; i++) {
|
||||
int total_offset = object_offset + object->GetInObjectPropertyOffset(i);
|
||||
Handle<Object> value = Handle<Object>(object->InObjectPropertyAt(i));
|
||||
Handle<Object> value = Handle<Object>(object->InObjectPropertyAt(i),
|
||||
isolate());
|
||||
if (value->IsJSObject()) {
|
||||
Handle<JSObject> value_object = Handle<JSObject>::cast(value);
|
||||
__ lea(ecx, Operand(result, *offset));
|
||||
@ -5661,7 +5662,7 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
|
||||
Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements);
|
||||
for (int i = 0; i < elements_length; i++) {
|
||||
int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i);
|
||||
Handle<Object> value(fast_elements->get(i));
|
||||
Handle<Object> value(fast_elements->get(i), isolate());
|
||||
if (value->IsJSObject()) {
|
||||
Handle<JSObject> value_object = Handle<JSObject>::cast(value);
|
||||
__ lea(ecx, Operand(result, *offset));
|
||||
|
@ -1969,11 +1969,11 @@ void MacroAssembler::PrepareCallApiFunction(int argc) {
|
||||
void MacroAssembler::CallApiFunctionAndReturn(Address function_address,
|
||||
int stack_space) {
|
||||
ExternalReference next_address =
|
||||
ExternalReference::handle_scope_next_address();
|
||||
ExternalReference::handle_scope_next_address(isolate());
|
||||
ExternalReference limit_address =
|
||||
ExternalReference::handle_scope_limit_address();
|
||||
ExternalReference::handle_scope_limit_address(isolate());
|
||||
ExternalReference level_address =
|
||||
ExternalReference::handle_scope_level_address();
|
||||
ExternalReference::handle_scope_level_address(isolate());
|
||||
|
||||
// Allocate HandleScope in callee-save registers.
|
||||
mov(ebx, Operand::StaticVariable(next_address));
|
||||
|
@ -784,7 +784,7 @@ class MacroAssembler: public Assembler {
|
||||
|
||||
// Push a handle value.
|
||||
void Push(Handle<Object> handle) { push(Immediate(handle)); }
|
||||
void Push(Smi* smi) { Push(Handle<Smi>(smi)); }
|
||||
void Push(Smi* smi) { Push(Handle<Smi>(smi, isolate())); }
|
||||
|
||||
Handle<Object> CodeObject() {
|
||||
ASSERT(!code_object_.is_null());
|
||||
|
@ -492,7 +492,7 @@ static void GenerateFastApiCall(MacroAssembler* masm,
|
||||
// Pass the additional arguments.
|
||||
__ mov(Operand(esp, 2 * kPointerSize), edi);
|
||||
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
|
||||
Handle<Object> call_data(api_call_info->data());
|
||||
Handle<Object> call_data(api_call_info->data(), masm->isolate());
|
||||
if (masm->isolate()->heap()->InNewSpace(*call_data)) {
|
||||
__ mov(ecx, api_call_info);
|
||||
__ mov(ebx, FieldOperand(ecx, CallHandlerInfo::kDataOffset));
|
||||
@ -1156,7 +1156,7 @@ void StubCompiler::GenerateLoadCallback(
|
||||
__ mov(scratch1, Immediate(callback));
|
||||
__ push(FieldOperand(scratch1, ExecutableAccessorInfo::kDataOffset));
|
||||
} else {
|
||||
__ push(Immediate(Handle<Object>(callback->data())));
|
||||
__ push(Immediate(Handle<Object>(callback->data(), isolate())));
|
||||
}
|
||||
__ push(Immediate(reinterpret_cast<int>(isolate())));
|
||||
|
||||
@ -3307,7 +3307,8 @@ Handle<Code> ConstructStubCompiler::CompileConstructStub(
|
||||
__ mov(Operand(edx, i * kPointerSize), ebx);
|
||||
} else {
|
||||
// Set the property to the constant value.
|
||||
Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i));
|
||||
Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i),
|
||||
isolate());
|
||||
__ mov(Operand(edx, i * kPointerSize), Immediate(constant));
|
||||
}
|
||||
}
|
||||
|
33
src/ic.cc
33
src/ic.cc
@ -434,7 +434,7 @@ static void LookupForRead(Handle<Object> object,
|
||||
return;
|
||||
}
|
||||
|
||||
Handle<Object> proto(holder->GetPrototype());
|
||||
Handle<Object> proto(holder->GetPrototype(), name->GetIsolate());
|
||||
if (proto->IsNull()) {
|
||||
ASSERT(!lookup->IsFound());
|
||||
return;
|
||||
@ -465,7 +465,8 @@ Handle<Object> CallICBase::TryCallAsFunction(Handle<Object> object) {
|
||||
void CallICBase::ReceiverToObjectIfRequired(Handle<Object> callee,
|
||||
Handle<Object> object) {
|
||||
while (callee->IsJSFunctionProxy()) {
|
||||
callee = Handle<Object>(JSFunctionProxy::cast(*callee)->call_trap());
|
||||
callee = Handle<Object>(JSFunctionProxy::cast(*callee)->call_trap(),
|
||||
isolate());
|
||||
}
|
||||
|
||||
if (callee->IsJSFunction()) {
|
||||
@ -784,7 +785,7 @@ MaybeObject* KeyedCallIC::LoadFunction(State state,
|
||||
TRACE_IC("KeyedCallIC", key, state, target());
|
||||
}
|
||||
|
||||
Handle<Object> result = GetProperty(object, key);
|
||||
Handle<Object> result = GetProperty(isolate(), object, key);
|
||||
RETURN_IF_EMPTY_HANDLE(isolate(), result);
|
||||
|
||||
// Make receiver an object if the callee requires it. Strict mode or builtin
|
||||
@ -837,7 +838,7 @@ MaybeObject* LoadIC::Load(State state,
|
||||
}
|
||||
// Get the string if we have a string wrapper object.
|
||||
Handle<Object> string = object->IsJSValue()
|
||||
? Handle<Object>(Handle<JSValue>::cast(object)->value())
|
||||
? Handle<Object>(Handle<JSValue>::cast(object)->value(), isolate())
|
||||
: object;
|
||||
return Smi::FromInt(String::cast(*string)->length());
|
||||
}
|
||||
@ -1051,7 +1052,7 @@ Handle<Code> LoadIC::ComputeLoadMonomorphic(LookupResult* lookup,
|
||||
if (!holder.is_identical_to(receiver)) break;
|
||||
return isolate()->stub_cache()->ComputeLoadNormal();
|
||||
case CALLBACKS: {
|
||||
Handle<Object> callback(lookup->GetCallbackObject());
|
||||
Handle<Object> callback(lookup->GetCallbackObject(), isolate());
|
||||
if (callback->IsExecutableAccessorInfo()) {
|
||||
Handle<ExecutableAccessorInfo> info =
|
||||
Handle<ExecutableAccessorInfo>::cast(callback);
|
||||
@ -1060,7 +1061,8 @@ Handle<Code> LoadIC::ComputeLoadMonomorphic(LookupResult* lookup,
|
||||
return isolate()->stub_cache()->ComputeLoadCallback(
|
||||
name, receiver, holder, info);
|
||||
} else if (callback->IsAccessorPair()) {
|
||||
Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter());
|
||||
Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(),
|
||||
isolate());
|
||||
if (!getter->IsJSFunction()) break;
|
||||
if (holder->IsGlobalObject()) break;
|
||||
if (!holder->HasFastProperties()) break;
|
||||
@ -1094,7 +1096,7 @@ static Handle<Object> TryConvertKey(Handle<Object> key, Isolate* isolate) {
|
||||
} else {
|
||||
int int_value = FastD2I(value);
|
||||
if (value == int_value && Smi::IsValid(int_value)) {
|
||||
key = Handle<Smi>(Smi::FromInt(int_value));
|
||||
key = Handle<Smi>(Smi::FromInt(int_value), isolate);
|
||||
}
|
||||
}
|
||||
} else if (key->IsUndefined()) {
|
||||
@ -1135,7 +1137,7 @@ static void GetReceiverMapsForStub(Handle<Code> stub,
|
||||
int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
|
||||
for (RelocIterator it(*stub, mask); !it.done(); it.next()) {
|
||||
RelocInfo* info = it.rinfo();
|
||||
Handle<Object> object(info->target_object());
|
||||
Handle<Object> object(info->target_object(), stub->GetIsolate());
|
||||
ASSERT(object->IsMap());
|
||||
AddOneReceiverMapIfMissing(result, Handle<Map>::cast(object));
|
||||
}
|
||||
@ -1283,7 +1285,7 @@ Handle<Code> KeyedLoadIC::ComputeLoadMonomorphic(LookupResult* lookup,
|
||||
name, receiver, holder, constant);
|
||||
}
|
||||
case CALLBACKS: {
|
||||
Handle<Object> callback_object(lookup->GetCallbackObject());
|
||||
Handle<Object> callback_object(lookup->GetCallbackObject(), isolate());
|
||||
// TODO(dcarney): Handle DeclaredAccessorInfo correctly.
|
||||
if (!callback_object->IsExecutableAccessorInfo()) break;
|
||||
Handle<ExecutableAccessorInfo> callback =
|
||||
@ -1477,7 +1479,7 @@ Handle<Code> StoreIC::ComputeStoreMonomorphic(LookupResult* lookup,
|
||||
if (!holder.is_identical_to(receiver)) break;
|
||||
return isolate()->stub_cache()->ComputeStoreNormal(strict_mode);
|
||||
case CALLBACKS: {
|
||||
Handle<Object> callback(lookup->GetCallbackObject());
|
||||
Handle<Object> callback(lookup->GetCallbackObject(), isolate());
|
||||
if (callback->IsExecutableAccessorInfo()) {
|
||||
Handle<ExecutableAccessorInfo> info =
|
||||
Handle<ExecutableAccessorInfo>::cast(callback);
|
||||
@ -1487,7 +1489,8 @@ Handle<Code> StoreIC::ComputeStoreMonomorphic(LookupResult* lookup,
|
||||
return isolate()->stub_cache()->ComputeStoreCallback(
|
||||
name, receiver, holder, info, strict_mode);
|
||||
} else if (callback->IsAccessorPair()) {
|
||||
Handle<Object> setter(Handle<AccessorPair>::cast(callback)->setter());
|
||||
Handle<Object> setter(Handle<AccessorPair>::cast(callback)->setter(),
|
||||
isolate());
|
||||
if (!setter->IsJSFunction()) break;
|
||||
if (holder->IsGlobalObject()) break;
|
||||
if (!holder->HasFastProperties()) break;
|
||||
@ -1919,7 +1922,7 @@ RUNTIME_FUNCTION(MaybeObject*, StoreIC_Miss) {
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) {
|
||||
NoHandleAllocation nha;
|
||||
NoHandleAllocation nha(isolate);
|
||||
|
||||
ASSERT(args.length() == 2);
|
||||
JSArray* receiver = JSArray::cast(args[0]);
|
||||
@ -1947,7 +1950,7 @@ RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) {
|
||||
// it is necessary to extend the properties array of a
|
||||
// JSObject.
|
||||
RUNTIME_FUNCTION(MaybeObject*, SharedStoreIC_ExtendStorage) {
|
||||
NoHandleAllocation na;
|
||||
NoHandleAllocation na(isolate);
|
||||
ASSERT(args.length() == 3);
|
||||
|
||||
// Convert the parameters
|
||||
@ -1996,7 +1999,7 @@ RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_Miss) {
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_Slow) {
|
||||
NoHandleAllocation na;
|
||||
NoHandleAllocation na(isolate);
|
||||
ASSERT(args.length() == 3);
|
||||
KeyedStoreIC ic(isolate);
|
||||
Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state();
|
||||
@ -2518,7 +2521,7 @@ void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) {
|
||||
|
||||
// Used from ICCompareStub::GenerateMiss in code-stubs-<arch>.cc.
|
||||
RUNTIME_FUNCTION(Code*, CompareIC_Miss) {
|
||||
NoHandleAllocation na;
|
||||
NoHandleAllocation na(isolate);
|
||||
ASSERT(args.length() == 3);
|
||||
CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2)));
|
||||
ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1));
|
||||
|
@ -627,7 +627,7 @@ Handle<JSArray> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object,
|
||||
Handle<Object> recv = frames[i].receiver();
|
||||
Handle<JSFunction> fun = frames[i].function();
|
||||
Handle<Code> code = frames[i].code();
|
||||
Handle<Smi> offset(Smi::FromInt(frames[i].offset()));
|
||||
Handle<Smi> offset(Smi::FromInt(frames[i].offset()), this);
|
||||
elements->set(cursor++, *recv);
|
||||
elements->set(cursor++, *fun);
|
||||
elements->set(cursor++, *code);
|
||||
@ -710,13 +710,13 @@ Handle<JSArray> Isolate::CaptureCurrentStackTrace(
|
||||
this,
|
||||
JSObject::SetLocalPropertyIgnoreAttributes(
|
||||
stack_frame, column_key,
|
||||
Handle<Smi>(Smi::FromInt(column_offset + 1)), NONE));
|
||||
Handle<Smi>(Smi::FromInt(column_offset + 1), this), NONE));
|
||||
}
|
||||
CHECK_NOT_EMPTY_HANDLE(
|
||||
this,
|
||||
JSObject::SetLocalPropertyIgnoreAttributes(
|
||||
stack_frame, line_key,
|
||||
Handle<Smi>(Smi::FromInt(line_number + 1)), NONE));
|
||||
Handle<Smi>(Smi::FromInt(line_number + 1), this), NONE));
|
||||
}
|
||||
|
||||
if (options & StackTrace::kScriptName) {
|
||||
@ -867,7 +867,7 @@ void Isolate::ReportFailedAccessCheck(JSObject* receiver, v8::AccessType type) {
|
||||
|
||||
HandleScope scope(this);
|
||||
Handle<JSObject> receiver_handle(receiver);
|
||||
Handle<Object> data(AccessCheckInfo::cast(data_obj)->data());
|
||||
Handle<Object> data(AccessCheckInfo::cast(data_obj)->data(), this);
|
||||
{ VMState state(this, EXTERNAL);
|
||||
thread_local_top()->failed_access_check_callback_(
|
||||
v8::Utils::ToLocal(receiver_handle),
|
||||
@ -1014,7 +1014,7 @@ Failure* Isolate::StackOverflow() {
|
||||
// attach the stack trace as a hidden property.
|
||||
Handle<String> key = factory()->stack_overflow_symbol();
|
||||
Handle<JSObject> boilerplate =
|
||||
Handle<JSObject>::cast(GetProperty(js_builtins_object(), key));
|
||||
Handle<JSObject>::cast(GetProperty(this, js_builtins_object(), key));
|
||||
Handle<JSObject> exception = Copy(boilerplate);
|
||||
DoThrow(*exception, NULL);
|
||||
|
||||
@ -1095,10 +1095,10 @@ void Isolate::PrintCurrentStackTrace(FILE* out) {
|
||||
// Find code position if recorded in relocation info.
|
||||
JavaScriptFrame* frame = it.frame();
|
||||
int pos = frame->LookupCode()->SourcePosition(frame->pc());
|
||||
Handle<Object> pos_obj(Smi::FromInt(pos));
|
||||
Handle<Object> pos_obj(Smi::FromInt(pos), this);
|
||||
// Fetch function and receiver.
|
||||
Handle<JSFunction> fun(JSFunction::cast(frame->function()));
|
||||
Handle<Object> recv(frame->receiver());
|
||||
Handle<Object> recv(frame->receiver(), this);
|
||||
// Advance to the next JavaScript frame and determine if the
|
||||
// current frame is the top-level frame.
|
||||
it.Advance();
|
||||
@ -1188,7 +1188,7 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) {
|
||||
ASSERT(!has_pending_exception());
|
||||
|
||||
HandleScope scope(this);
|
||||
Handle<Object> exception_handle(exception);
|
||||
Handle<Object> exception_handle(exception, this);
|
||||
|
||||
// Determine reporting and whether the exception is caught externally.
|
||||
bool catchable_by_javascript = is_catchable_by_javascript(exception);
|
||||
@ -1363,7 +1363,8 @@ void Isolate::ReportPendingMessages() {
|
||||
thread_local_top_.has_pending_message_ = false;
|
||||
if (!thread_local_top_.pending_message_obj_->IsTheHole()) {
|
||||
HandleScope scope(this);
|
||||
Handle<Object> message_obj(thread_local_top_.pending_message_obj_);
|
||||
Handle<Object> message_obj(thread_local_top_.pending_message_obj_,
|
||||
this);
|
||||
if (thread_local_top_.pending_message_script_ != NULL) {
|
||||
Handle<Script> script(thread_local_top_.pending_message_script_);
|
||||
int start_pos = thread_local_top_.pending_message_start_pos_;
|
||||
|
@ -673,7 +673,8 @@ class Isolate {
|
||||
// Scope currently can only be used for regular exceptions, not
|
||||
// failures like OOM or termination exception.
|
||||
isolate_(isolate),
|
||||
pending_exception_(isolate_->pending_exception()->ToObjectUnchecked()),
|
||||
pending_exception_(isolate_->pending_exception()->ToObjectUnchecked(),
|
||||
isolate_),
|
||||
catcher_(isolate_->catcher())
|
||||
{ }
|
||||
|
||||
@ -813,9 +814,9 @@ class Isolate {
|
||||
ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_ACCESSOR)
|
||||
#undef GLOBAL_ARRAY_ACCESSOR
|
||||
|
||||
#define NATIVE_CONTEXT_FIELD_ACCESSOR(index, type, name) \
|
||||
Handle<type> name() { \
|
||||
return Handle<type>(context()->native_context()->name()); \
|
||||
#define NATIVE_CONTEXT_FIELD_ACCESSOR(index, type, name) \
|
||||
Handle<type> name() { \
|
||||
return Handle<type>(context()->native_context()->name(), this); \
|
||||
}
|
||||
NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSOR)
|
||||
#undef NATIVE_CONTEXT_FIELD_ACCESSOR
|
||||
|
@ -228,7 +228,8 @@ Handle<Object> JsonParser<seq_ascii>::ParseJson(Handle<String> source,
|
||||
break;
|
||||
default:
|
||||
message = "unexpected_token";
|
||||
Handle<Object> name = LookupSingleCharacterStringFromCode(c0_);
|
||||
Handle<Object> name =
|
||||
LookupSingleCharacterStringFromCode(isolate_, c0_);
|
||||
Handle<FixedArray> element = factory->NewFixedArray(1);
|
||||
element->set(0, *name);
|
||||
array = factory->NewJSArrayWithElements(element);
|
||||
|
@ -91,8 +91,12 @@ class BasicJsonStringifier BASE_EMBEDDED {
|
||||
|
||||
// Serialize an array element.
|
||||
// The index may serve as argument for the toJSON function.
|
||||
INLINE(Result SerializeElement(Handle<Object> object, int i)) {
|
||||
return Serialize_<false>(object, false, Handle<Object>(Smi::FromInt(i)));
|
||||
INLINE(Result SerializeElement(Isolate* isolate,
|
||||
Handle<Object> object,
|
||||
int i)) {
|
||||
return Serialize_<false>(object,
|
||||
false,
|
||||
Handle<Object>(Smi::FromInt(i), isolate));
|
||||
}
|
||||
|
||||
// Serialize a object property.
|
||||
@ -504,7 +508,9 @@ BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSArray(
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (i > 0) Append(',');
|
||||
Result result =
|
||||
SerializeElement(Handle<Object>(elements->get(i), isolate_), i);
|
||||
SerializeElement(isolate_,
|
||||
Handle<Object>(elements->get(i), isolate_),
|
||||
i);
|
||||
if (result == SUCCESS) continue;
|
||||
if (result == UNCHANGED) {
|
||||
AppendAscii("null");
|
||||
@ -538,7 +544,7 @@ BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSArraySlow(
|
||||
if (element->IsUndefined()) {
|
||||
AppendAscii("null");
|
||||
} else {
|
||||
Result result = SerializeElement(element, i);
|
||||
Result result = SerializeElement(object->GetIsolate(), element, i);
|
||||
if (result == SUCCESS) continue;
|
||||
if (result == UNCHANGED) {
|
||||
AppendAscii("null");
|
||||
@ -581,7 +587,7 @@ BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSObject(
|
||||
map->instance_descriptors()->GetFieldIndex(i)),
|
||||
isolate_);
|
||||
} else {
|
||||
property = GetProperty(object, key);
|
||||
property = GetProperty(isolate_, object, key);
|
||||
if (property.is_null()) return EXCEPTION;
|
||||
}
|
||||
Result result = SerializeProperty(property, comma, key);
|
||||
@ -600,7 +606,7 @@ BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSObject(
|
||||
Handle<Object> property;
|
||||
if (key->IsString()) {
|
||||
key_handle = Handle<String>(String::cast(key), isolate_);
|
||||
property = GetProperty(object, key_handle);
|
||||
property = GetProperty(isolate_, object, key_handle);
|
||||
} else {
|
||||
ASSERT(key->IsNumber());
|
||||
key_handle = factory_->NumberToString(Handle<Object>(key, isolate_));
|
||||
@ -610,7 +616,7 @@ BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSObject(
|
||||
} else if (key_handle->AsArrayIndex(&index)) {
|
||||
property = Object::GetElement(object, index);
|
||||
} else {
|
||||
property = GetProperty(object, key_handle);
|
||||
property = GetProperty(isolate_, object, key_handle);
|
||||
}
|
||||
}
|
||||
if (property.is_null()) return EXCEPTION;
|
||||
|
@ -270,7 +270,7 @@ static void SetAtomLastCapture(FixedArray* array,
|
||||
String* subject,
|
||||
int from,
|
||||
int to) {
|
||||
NoHandleAllocation no_handles;
|
||||
NoHandleAllocation no_handles(array->GetIsolate());
|
||||
RegExpImpl::SetLastCaptureCount(array, 2);
|
||||
RegExpImpl::SetLastSubject(array, subject);
|
||||
RegExpImpl::SetLastInput(array, subject);
|
||||
@ -353,7 +353,7 @@ Handle<Object> RegExpImpl::AtomExec(Handle<JSRegExp> re,
|
||||
if (res == RegExpImpl::RE_FAILURE) return isolate->factory()->null_value();
|
||||
|
||||
ASSERT_EQ(res, RegExpImpl::RE_SUCCESS);
|
||||
NoHandleAllocation no_handles;
|
||||
NoHandleAllocation no_handles(isolate);
|
||||
FixedArray* array = FixedArray::cast(last_match_info->elements());
|
||||
SetAtomLastCapture(array, *subject, output_registers[0], output_registers[1]);
|
||||
return last_match_info;
|
||||
|
@ -416,7 +416,7 @@ Representation LChunk::LookupLiteralRepresentation(
|
||||
|
||||
|
||||
LChunk* LChunk::NewChunk(HGraph* graph) {
|
||||
NoHandleAllocation no_handles;
|
||||
NoHandleAllocation no_handles(graph->isolate());
|
||||
AssertNoAllocation no_gc;
|
||||
|
||||
int values = graph->GetMaximumValueID();
|
||||
|
@ -349,23 +349,26 @@ static void NarrowDownInput(SubrangableInput* input,
|
||||
// Each chunk is stored as 3 array elements: (pos1_begin, pos1_end, pos2_end).
|
||||
class CompareOutputArrayWriter {
|
||||
public:
|
||||
CompareOutputArrayWriter()
|
||||
: array_(FACTORY->NewJSArray(10)), current_size_(0) {}
|
||||
explicit CompareOutputArrayWriter(Isolate* isolate)
|
||||
: array_(isolate->factory()->NewJSArray(10)), current_size_(0) {}
|
||||
|
||||
Handle<JSArray> GetResult() {
|
||||
return array_;
|
||||
}
|
||||
|
||||
void WriteChunk(int char_pos1, int char_pos2, int char_len1, int char_len2) {
|
||||
Isolate* isolate = array_->GetIsolate();
|
||||
SetElementNonStrict(array_,
|
||||
current_size_,
|
||||
Handle<Object>(Smi::FromInt(char_pos1)));
|
||||
current_size_,
|
||||
Handle<Object>(Smi::FromInt(char_pos1), isolate));
|
||||
SetElementNonStrict(array_,
|
||||
current_size_ + 1,
|
||||
Handle<Object>(Smi::FromInt(char_pos1 + char_len1)));
|
||||
Handle<Object>(Smi::FromInt(char_pos1 + char_len1),
|
||||
isolate));
|
||||
SetElementNonStrict(array_,
|
||||
current_size_ + 2,
|
||||
Handle<Object>(Smi::FromInt(char_pos2 + char_len2)));
|
||||
Handle<Object>(Smi::FromInt(char_pos2 + char_len2),
|
||||
isolate));
|
||||
current_size_ += 3;
|
||||
}
|
||||
|
||||
@ -527,7 +530,8 @@ class TokenizingLineArrayCompareOutput : public SubrangableOutput {
|
||||
TokenizingLineArrayCompareOutput(LineEndsWrapper line_ends1,
|
||||
LineEndsWrapper line_ends2,
|
||||
Handle<String> s1, Handle<String> s2)
|
||||
: line_ends1_(line_ends1), line_ends2_(line_ends2), s1_(s1), s2_(s2),
|
||||
: array_writer_(s1->GetIsolate()),
|
||||
line_ends1_(line_ends1), line_ends2_(line_ends2), s1_(s1), s2_(s2),
|
||||
subrange_offset1_(0), subrange_offset2_(0) {
|
||||
}
|
||||
|
||||
@ -620,7 +624,7 @@ static void CompileScriptForTracker(Isolate* isolate, Handle<Script> script) {
|
||||
|
||||
// Unwraps JSValue object, returning its field "value"
|
||||
static Handle<Object> UnwrapJSValue(Handle<JSValue> jsValue) {
|
||||
return Handle<Object>(jsValue->value());
|
||||
return Handle<Object>(jsValue->value(), jsValue->GetIsolate());
|
||||
}
|
||||
|
||||
|
||||
@ -682,7 +686,7 @@ class JSArrayBasedStruct {
|
||||
void SetSmiValueField(int field_position, int value) {
|
||||
SetElementNonStrict(array_,
|
||||
field_position,
|
||||
Handle<Smi>(Smi::FromInt(value)));
|
||||
Handle<Smi>(Smi::FromInt(value), isolate()));
|
||||
}
|
||||
Object* GetField(int field_position) {
|
||||
return array_->GetElementNoExceptionThrown(field_position);
|
||||
@ -818,14 +822,14 @@ class SharedInfoWrapper : public JSArrayBasedStruct<SharedInfoWrapper> {
|
||||
|
||||
class FunctionInfoListener {
|
||||
public:
|
||||
FunctionInfoListener() {
|
||||
explicit FunctionInfoListener(Isolate* isolate) {
|
||||
current_parent_index_ = -1;
|
||||
len_ = 0;
|
||||
result_ = FACTORY->NewJSArray(10);
|
||||
result_ = isolate->factory()->NewJSArray(10);
|
||||
}
|
||||
|
||||
void FunctionStarted(FunctionLiteral* fun) {
|
||||
HandleScope scope(result_->GetIsolate());
|
||||
HandleScope scope(isolate());
|
||||
FunctionInfoWrapper info = FunctionInfoWrapper::Create();
|
||||
info.SetInitialProperties(fun->name(), fun->start_position(),
|
||||
fun->end_position(), fun->parameter_count(),
|
||||
@ -837,7 +841,7 @@ class FunctionInfoListener {
|
||||
}
|
||||
|
||||
void FunctionDone() {
|
||||
HandleScope scope(result_->GetIsolate());
|
||||
HandleScope scope(isolate());
|
||||
FunctionInfoWrapper info =
|
||||
FunctionInfoWrapper::cast(
|
||||
result_->GetElementNoExceptionThrown(current_parent_index_));
|
||||
@ -850,7 +854,9 @@ class FunctionInfoListener {
|
||||
FunctionInfoWrapper info =
|
||||
FunctionInfoWrapper::cast(
|
||||
result_->GetElementNoExceptionThrown(current_parent_index_));
|
||||
info.SetFunctionCode(function_code, Handle<Object>(HEAP->null_value()));
|
||||
info.SetFunctionCode(function_code,
|
||||
Handle<Object>(isolate()->heap()->null_value(),
|
||||
isolate()));
|
||||
}
|
||||
|
||||
// Saves full information about a function: its code, its scope info
|
||||
@ -864,21 +870,23 @@ class FunctionInfoListener {
|
||||
FunctionInfoWrapper::cast(
|
||||
result_->GetElementNoExceptionThrown(current_parent_index_));
|
||||
info.SetFunctionCode(Handle<Code>(shared->code()),
|
||||
Handle<Object>(shared->scope_info()));
|
||||
Handle<Object>(shared->scope_info(), isolate()));
|
||||
info.SetSharedFunctionInfo(shared);
|
||||
|
||||
Handle<Object> scope_info_list(
|
||||
SerializeFunctionScope(shared->GetIsolate(), scope, zone));
|
||||
Handle<Object> scope_info_list(SerializeFunctionScope(scope, zone),
|
||||
isolate());
|
||||
info.SetOuterScopeInfo(scope_info_list);
|
||||
}
|
||||
|
||||
Handle<JSArray> GetResult() { return result_; }
|
||||
|
||||
private:
|
||||
Object* SerializeFunctionScope(Isolate* isolate, Scope* scope, Zone* zone) {
|
||||
HandleScope handle_scope(isolate);
|
||||
Isolate* isolate() const { return result_->GetIsolate(); }
|
||||
|
||||
Handle<JSArray> scope_info_list = isolate->factory()->NewJSArray(10);
|
||||
Object* SerializeFunctionScope(Scope* scope, Zone* zone) {
|
||||
HandleScope handle_scope(isolate());
|
||||
|
||||
Handle<JSArray> scope_info_list = isolate()->factory()->NewJSArray(10);
|
||||
int scope_info_length = 0;
|
||||
|
||||
// Saves some description of scope. It stores name and indexes of
|
||||
@ -886,7 +894,7 @@ class FunctionInfoListener {
|
||||
// scopes of this chain.
|
||||
Scope* outer_scope = scope->outer_scope();
|
||||
if (outer_scope == NULL) {
|
||||
return isolate->heap()->undefined_value();
|
||||
return isolate()->heap()->undefined_value();
|
||||
}
|
||||
do {
|
||||
ZoneList<Variable*> stack_list(outer_scope->StackLocalCount(), zone);
|
||||
@ -902,12 +910,13 @@ class FunctionInfoListener {
|
||||
SetElementNonStrict(
|
||||
scope_info_list,
|
||||
scope_info_length,
|
||||
Handle<Smi>(Smi::FromInt(context_list[i]->index())));
|
||||
Handle<Smi>(Smi::FromInt(context_list[i]->index()), isolate()));
|
||||
scope_info_length++;
|
||||
}
|
||||
SetElementNonStrict(scope_info_list,
|
||||
scope_info_length,
|
||||
Handle<Object>(isolate->heap()->null_value()));
|
||||
Handle<Object>(isolate()->heap()->null_value(),
|
||||
isolate()));
|
||||
scope_info_length++;
|
||||
|
||||
outer_scope = outer_scope->outer_scope();
|
||||
@ -926,8 +935,9 @@ JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script,
|
||||
Handle<String> source) {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
|
||||
FunctionInfoListener listener;
|
||||
Handle<Object> original_source = Handle<Object>(script->source());
|
||||
FunctionInfoListener listener(isolate);
|
||||
Handle<Object> original_source =
|
||||
Handle<Object>(script->source(), isolate);
|
||||
script->set_source(*source);
|
||||
isolate->set_active_function_info_listener(&listener);
|
||||
|
||||
@ -944,7 +954,8 @@ JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script,
|
||||
// A logical 'catch' section.
|
||||
Handle<JSObject> rethrow_exception;
|
||||
if (isolate->has_pending_exception()) {
|
||||
Handle<Object> exception(isolate->pending_exception()->ToObjectChecked());
|
||||
Handle<Object> exception(isolate->pending_exception()->ToObjectChecked(),
|
||||
isolate);
|
||||
MessageLocation message_location = isolate->GetMessageLocation();
|
||||
|
||||
isolate->clear_pending_message();
|
||||
@ -961,8 +972,9 @@ JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script,
|
||||
factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("endPosition"));
|
||||
Handle<String> script_obj_key =
|
||||
factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("scriptObject"));
|
||||
Handle<Smi> start_pos(Smi::FromInt(message_location.start_pos()));
|
||||
Handle<Smi> end_pos(Smi::FromInt(message_location.end_pos()));
|
||||
Handle<Smi> start_pos(Smi::FromInt(message_location.start_pos()),
|
||||
isolate);
|
||||
Handle<Smi> end_pos(Smi::FromInt(message_location.end_pos()), isolate);
|
||||
Handle<JSValue> script_obj = GetScriptWrapper(message_location.script());
|
||||
JSReceiver::SetProperty(
|
||||
rethrow_exception, start_pos_key, start_pos, NONE, kNonStrictMode);
|
||||
@ -1552,15 +1564,16 @@ static Handle<Script> CreateScriptCopy(Handle<Script> original) {
|
||||
Object* LiveEdit::ChangeScriptSource(Handle<Script> original_script,
|
||||
Handle<String> new_source,
|
||||
Handle<Object> old_script_name) {
|
||||
Isolate* isolate = original_script->GetIsolate();
|
||||
Handle<Object> old_script_object;
|
||||
if (old_script_name->IsString()) {
|
||||
Handle<Script> old_script = CreateScriptCopy(original_script);
|
||||
old_script->set_name(String::cast(*old_script_name));
|
||||
old_script_object = old_script;
|
||||
Isolate::Current()->debugger()->OnAfterCompile(
|
||||
isolate->debugger()->OnAfterCompile(
|
||||
old_script, Debugger::SEND_WHEN_DEBUGGING);
|
||||
} else {
|
||||
old_script_object = Handle<Object>(HEAP->null_value());
|
||||
old_script_object = isolate->factory()->null_value();
|
||||
}
|
||||
|
||||
original_script->set_source(*new_source);
|
||||
@ -1606,6 +1619,7 @@ static bool CheckActivation(Handle<JSArray> shared_info_array,
|
||||
Handle<JSFunction> function(
|
||||
JSFunction::cast(JavaScriptFrame::cast(frame)->function()));
|
||||
|
||||
Isolate* isolate = shared_info_array->GetIsolate();
|
||||
int len = GetArrayLength(shared_info_array);
|
||||
for (int i = 0; i < len; i++) {
|
||||
Object* element = shared_info_array->GetElementNoExceptionThrown(i);
|
||||
@ -1615,7 +1629,8 @@ static bool CheckActivation(Handle<JSArray> shared_info_array,
|
||||
UnwrapSharedFunctionInfoFromJSValue(jsvalue);
|
||||
|
||||
if (function->shared() == *shared || IsInlined(*function, *shared)) {
|
||||
SetElementNonStrict(result, i, Handle<Smi>(Smi::FromInt(status)));
|
||||
SetElementNonStrict(result, i, Handle<Smi>(Smi::FromInt(status),
|
||||
isolate));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -1920,6 +1935,7 @@ static const char* DropActivationsInActiveThread(
|
||||
return message;
|
||||
}
|
||||
|
||||
Isolate* isolate = shared_info_array->GetIsolate();
|
||||
int array_len = GetArrayLength(shared_info_array);
|
||||
|
||||
// Replace "blocked on active" with "replaced on active" status.
|
||||
@ -1927,7 +1943,7 @@ static const char* DropActivationsInActiveThread(
|
||||
if (result->GetElement(i) ==
|
||||
Smi::FromInt(LiveEdit::FUNCTION_BLOCKED_ON_ACTIVE_STACK)) {
|
||||
Handle<Object> replaced(
|
||||
Smi::FromInt(LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK));
|
||||
Smi::FromInt(LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK), isolate);
|
||||
SetElementNonStrict(result, i, replaced);
|
||||
}
|
||||
}
|
||||
@ -1962,16 +1978,17 @@ class InactiveThreadActivationsChecker : public ThreadVisitor {
|
||||
|
||||
Handle<JSArray> LiveEdit::CheckAndDropActivations(
|
||||
Handle<JSArray> shared_info_array, bool do_drop, Zone* zone) {
|
||||
Isolate* isolate = shared_info_array->GetIsolate();
|
||||
int len = GetArrayLength(shared_info_array);
|
||||
|
||||
Handle<JSArray> result = FACTORY->NewJSArray(len);
|
||||
Handle<JSArray> result = isolate->factory()->NewJSArray(len);
|
||||
|
||||
// Fill the default values.
|
||||
for (int i = 0; i < len; i++) {
|
||||
SetElementNonStrict(
|
||||
result,
|
||||
i,
|
||||
Handle<Smi>(Smi::FromInt(FUNCTION_AVAILABLE_FOR_PATCH)));
|
||||
Handle<Smi>(Smi::FromInt(FUNCTION_AVAILABLE_FOR_PATCH), isolate));
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,7 +46,7 @@ void MessageHandler::DefaultMessageReport(Isolate* isolate,
|
||||
PrintF("%s\n", *str);
|
||||
} else {
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> data(loc->script()->name());
|
||||
Handle<Object> data(loc->script()->name(), isolate);
|
||||
SmartArrayPointer<char> data_str;
|
||||
if (data->IsString())
|
||||
data_str = Handle<String>::cast(data)->ToCString(DISALLOW_NULLS);
|
||||
@ -113,7 +113,7 @@ void MessageHandler::ReportMessage(Isolate* isolate,
|
||||
if (isolate->has_pending_exception()) {
|
||||
isolate->pending_exception()->ToObject(&exception_object);
|
||||
}
|
||||
Handle<Object> exception_handle(exception_object);
|
||||
Handle<Object> exception_handle(exception_object, isolate);
|
||||
|
||||
Isolate::ExceptionScope exception_scope(isolate);
|
||||
isolate->clear_pending_exception();
|
||||
@ -149,28 +149,30 @@ void MessageHandler::ReportMessage(Isolate* isolate,
|
||||
}
|
||||
|
||||
|
||||
Handle<String> MessageHandler::GetMessage(Handle<Object> data) {
|
||||
Handle<String> MessageHandler::GetMessage(Isolate* isolate,
|
||||
Handle<Object> data) {
|
||||
Factory* factory = isolate->factory();
|
||||
Handle<String> fmt_str =
|
||||
FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("FormatMessage"));
|
||||
factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("FormatMessage"));
|
||||
Handle<JSFunction> fun =
|
||||
Handle<JSFunction>(
|
||||
JSFunction::cast(
|
||||
Isolate::Current()->js_builtins_object()->
|
||||
isolate->js_builtins_object()->
|
||||
GetPropertyNoExceptionThrown(*fmt_str)));
|
||||
Handle<JSMessageObject> message = Handle<JSMessageObject>::cast(data);
|
||||
Handle<Object> argv[] = { Handle<Object>(message->type()),
|
||||
Handle<Object>(message->arguments()) };
|
||||
Handle<Object> argv[] = { Handle<Object>(message->type(), isolate),
|
||||
Handle<Object>(message->arguments(), isolate) };
|
||||
|
||||
bool caught_exception;
|
||||
Handle<Object> result =
|
||||
Execution::TryCall(fun,
|
||||
Isolate::Current()->js_builtins_object(),
|
||||
isolate->js_builtins_object(),
|
||||
ARRAY_SIZE(argv),
|
||||
argv,
|
||||
&caught_exception);
|
||||
|
||||
if (caught_exception || !result->IsString()) {
|
||||
return FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("<error>"));
|
||||
return factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("<error>"));
|
||||
}
|
||||
Handle<String> result_string = Handle<String>::cast(result);
|
||||
// A string that has been obtained from JS code in this way is
|
||||
@ -187,7 +189,7 @@ SmartArrayPointer<char> MessageHandler::GetLocalizedMessage(
|
||||
Isolate* isolate,
|
||||
Handle<Object> data) {
|
||||
HandleScope scope(isolate);
|
||||
return GetMessage(data)->ToCString(DISALLOW_NULLS);
|
||||
return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -105,7 +105,7 @@ class MessageHandler {
|
||||
static void DefaultMessageReport(Isolate* isolate,
|
||||
const MessageLocation* loc,
|
||||
Handle<Object> message_obj);
|
||||
static Handle<String> GetMessage(Handle<Object> data);
|
||||
static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data);
|
||||
static SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate,
|
||||
Handle<Object> data);
|
||||
};
|
||||
|
@ -1171,7 +1171,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
Handle<JSGlobalPropertyCell> cell =
|
||||
isolate()->factory()->NewJSGlobalPropertyCell(
|
||||
Handle<Object>(
|
||||
Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker)));
|
||||
Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker),
|
||||
isolate()));
|
||||
RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell);
|
||||
__ LoadHeapObject(a1, cell);
|
||||
__ li(a2, Operand(Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker)));
|
||||
|
@ -5418,7 +5418,8 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
|
||||
// Copy in-object properties.
|
||||
for (int i = 0; i < inobject_properties; i++) {
|
||||
int total_offset = object_offset + object->GetInObjectPropertyOffset(i);
|
||||
Handle<Object> value = Handle<Object>(object->InObjectPropertyAt(i));
|
||||
Handle<Object> value = Handle<Object>(object->InObjectPropertyAt(i),
|
||||
isolate());
|
||||
if (value->IsJSObject()) {
|
||||
Handle<JSObject> value_object = Handle<JSObject>::cast(value);
|
||||
__ Addu(a2, result, Operand(*offset));
|
||||
@ -5472,7 +5473,7 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
|
||||
Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements);
|
||||
for (int i = 0; i < elements_length; i++) {
|
||||
int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i);
|
||||
Handle<Object> value(fast_elements->get(i));
|
||||
Handle<Object> value(fast_elements->get(i), isolate());
|
||||
if (value->IsJSObject()) {
|
||||
Handle<JSObject> value_object = Handle<JSObject>::cast(value);
|
||||
__ Addu(a2, result, Operand(*offset));
|
||||
|
@ -3960,13 +3960,13 @@ static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
|
||||
void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function,
|
||||
int stack_space) {
|
||||
ExternalReference next_address =
|
||||
ExternalReference::handle_scope_next_address();
|
||||
ExternalReference::handle_scope_next_address(isolate());
|
||||
const int kNextOffset = 0;
|
||||
const int kLimitOffset = AddressOffset(
|
||||
ExternalReference::handle_scope_limit_address(),
|
||||
ExternalReference::handle_scope_limit_address(isolate()),
|
||||
next_address);
|
||||
const int kLevelOffset = AddressOffset(
|
||||
ExternalReference::handle_scope_level_address(),
|
||||
ExternalReference::handle_scope_level_address(isolate()),
|
||||
next_address);
|
||||
|
||||
// Allocate HandleScope in callee-save registers.
|
||||
|
@ -629,7 +629,7 @@ class MacroAssembler: public Assembler {
|
||||
|
||||
// Push a handle.
|
||||
void Push(Handle<Object> handle);
|
||||
void Push(Smi* smi) { Push(Handle<Smi>(smi)); }
|
||||
void Push(Smi* smi) { Push(Handle<Smi>(smi, isolate())); }
|
||||
|
||||
// Push two registers. Pushes leftmost register first (to highest address).
|
||||
void Push(Register src1, Register src2) {
|
||||
|
@ -696,7 +696,7 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm,
|
||||
|
||||
// Pass the additional arguments.
|
||||
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
|
||||
Handle<Object> call_data(api_call_info->data());
|
||||
Handle<Object> call_data(api_call_info->data(), masm->isolate());
|
||||
if (masm->isolate()->heap()->InNewSpace(*call_data)) {
|
||||
__ li(a0, api_call_info);
|
||||
__ lw(t2, FieldMemOperand(a0, CallHandlerInfo::kDataOffset));
|
||||
@ -1282,7 +1282,7 @@ void StubCompiler::GenerateLoadCallback(
|
||||
__ lw(scratch3,
|
||||
FieldMemOperand(scratch3, ExecutableAccessorInfo::kDataOffset));
|
||||
} else {
|
||||
__ li(scratch3, Handle<Object>(callback->data()));
|
||||
__ li(scratch3, Handle<Object>(callback->data(), masm()->isolate()));
|
||||
}
|
||||
__ Subu(sp, sp, 4 * kPointerSize);
|
||||
__ sw(reg, MemOperand(sp, 3 * kPointerSize));
|
||||
@ -3330,7 +3330,8 @@ Handle<Code> ConstructStubCompiler::CompileConstructStub(
|
||||
__ bind(&next);
|
||||
} else {
|
||||
// Set the property to the constant value.
|
||||
Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i));
|
||||
Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i),
|
||||
masm()->isolate());
|
||||
__ li(a2, Operand(constant));
|
||||
__ sw(a2, MemOperand(t5));
|
||||
__ Addu(t5, t5, kPointerSize);
|
||||
|
@ -183,8 +183,8 @@ MaybeObject* JSObject::GetPropertyWithCallback(Object* receiver,
|
||||
if (structure->IsExecutableAccessorInfo()) {
|
||||
ExecutableAccessorInfo* data = ExecutableAccessorInfo::cast(structure);
|
||||
if (!data->IsCompatibleReceiver(receiver)) {
|
||||
Handle<Object> name_handle(name);
|
||||
Handle<Object> receiver_handle(receiver);
|
||||
Handle<Object> name_handle(name, isolate);
|
||||
Handle<Object> receiver_handle(receiver, isolate);
|
||||
Handle<Object> args[2] = { name_handle, receiver_handle };
|
||||
Handle<Object> error =
|
||||
isolate->factory()->NewTypeError("incompatible_method_receiver",
|
||||
@ -241,8 +241,8 @@ MaybeObject* JSProxy::GetPropertyWithHandler(Object* receiver_raw,
|
||||
String* name_raw) {
|
||||
Isolate* isolate = GetIsolate();
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> receiver(receiver_raw);
|
||||
Handle<Object> name(name_raw);
|
||||
Handle<Object> receiver(receiver_raw, isolate);
|
||||
Handle<Object> name(name_raw, isolate);
|
||||
|
||||
Handle<Object> args[] = { receiver, name };
|
||||
Handle<Object> result = CallTrap(
|
||||
@ -306,7 +306,7 @@ MaybeObject* Object::GetPropertyWithDefinedGetter(Object* receiver,
|
||||
Isolate* isolate = getter->GetIsolate();
|
||||
HandleScope scope(isolate);
|
||||
Handle<JSReceiver> fun(getter);
|
||||
Handle<Object> self(receiver);
|
||||
Handle<Object> self(receiver, isolate);
|
||||
#ifdef ENABLE_DEBUGGER_SUPPORT
|
||||
Debug* debug = isolate->debug();
|
||||
// Handle stepping into a getter if step into is active.
|
||||
@ -1762,7 +1762,7 @@ void JSObject::EnqueueChangeRecord(Handle<JSObject> object,
|
||||
Handle<Object> args[] = { type, object, name, old_value };
|
||||
bool threw;
|
||||
Execution::Call(Handle<JSFunction>(isolate->observers_notify_change()),
|
||||
Handle<Object>(isolate->heap()->undefined_value()),
|
||||
isolate->factory()->undefined_value(),
|
||||
old_value->IsTheHole() ? 3 : 4, args,
|
||||
&threw);
|
||||
ASSERT(!threw);
|
||||
@ -2013,8 +2013,8 @@ MaybeObject* JSObject::SetPropertyWithCallback(Object* structure,
|
||||
// api style callbacks
|
||||
ExecutableAccessorInfo* data = ExecutableAccessorInfo::cast(structure);
|
||||
if (!data->IsCompatibleReceiver(this)) {
|
||||
Handle<Object> name_handle(name);
|
||||
Handle<Object> receiver_handle(this);
|
||||
Handle<Object> name_handle(name, isolate);
|
||||
Handle<Object> receiver_handle(this, isolate);
|
||||
Handle<Object> args[2] = { name_handle, receiver_handle };
|
||||
Handle<Object> error =
|
||||
isolate->factory()->NewTypeError("incompatible_method_receiver",
|
||||
@ -2183,7 +2183,8 @@ MaybeObject* JSObject::SetPropertyViaPrototypes(
|
||||
if (!FLAG_es5_readonly) *done = false;
|
||||
if (*done) {
|
||||
if (strict_mode == kNonStrictMode) return value;
|
||||
Handle<Object> args[] = { Handle<Object>(name), Handle<Object>(this)};
|
||||
Handle<Object> args[] = { Handle<Object>(name, isolate),
|
||||
Handle<Object>(this, isolate)};
|
||||
return isolate->Throw(*isolate->factory()->NewTypeError(
|
||||
"strict_read_only_property", HandleVector(args, ARRAY_SIZE(args))));
|
||||
}
|
||||
@ -2568,7 +2569,7 @@ MaybeObject* JSObject::SetPropertyWithFailedAccessCheck(
|
||||
|
||||
Isolate* isolate = GetIsolate();
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> value_handle(value);
|
||||
Handle<Object> value_handle(value, isolate);
|
||||
isolate->ReportFailedAccessCheck(this, v8::ACCESS_SET);
|
||||
return *value_handle;
|
||||
}
|
||||
@ -2593,8 +2594,8 @@ MaybeObject* JSReceiver::SetProperty(LookupResult* result,
|
||||
bool JSProxy::HasPropertyWithHandler(String* name_raw) {
|
||||
Isolate* isolate = GetIsolate();
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> receiver(this);
|
||||
Handle<Object> name(name_raw);
|
||||
Handle<Object> receiver(this, isolate);
|
||||
Handle<Object> name(name_raw, isolate);
|
||||
|
||||
Handle<Object> args[] = { name };
|
||||
Handle<Object> result = CallTrap(
|
||||
@ -2614,8 +2615,8 @@ MUST_USE_RESULT MaybeObject* JSProxy::SetPropertyWithHandler(
|
||||
Isolate* isolate = GetIsolate();
|
||||
HandleScope scope(isolate);
|
||||
Handle<JSReceiver> receiver(receiver_raw);
|
||||
Handle<Object> name(name_raw);
|
||||
Handle<Object> value(value_raw);
|
||||
Handle<Object> name(name_raw, isolate);
|
||||
Handle<Object> value(value_raw, isolate);
|
||||
|
||||
Handle<Object> args[] = { receiver, name, value };
|
||||
CallTrap("set", isolate->derived_set_trap(), ARRAY_SIZE(args), args);
|
||||
@ -2636,8 +2637,8 @@ MUST_USE_RESULT MaybeObject* JSProxy::SetPropertyViaPrototypesWithHandler(
|
||||
Handle<JSProxy> proxy(this);
|
||||
Handle<JSReceiver> receiver(receiver_raw);
|
||||
Handle<String> name(name_raw);
|
||||
Handle<Object> value(value_raw);
|
||||
Handle<Object> handler(this->handler()); // Trap might morph proxy.
|
||||
Handle<Object> value(value_raw, isolate);
|
||||
Handle<Object> handler(this->handler(), isolate); // Trap might morph proxy.
|
||||
|
||||
*done = true; // except where redefined...
|
||||
Handle<Object> args[] = { name };
|
||||
@ -2662,7 +2663,7 @@ MUST_USE_RESULT MaybeObject* JSProxy::SetPropertyViaPrototypesWithHandler(
|
||||
Handle<String> configurable_name = isolate->factory()->LookupOneByteSymbol(
|
||||
STATIC_ASCII_VECTOR("configurable_"));
|
||||
Handle<Object> configurable(
|
||||
v8::internal::GetProperty(desc, configurable_name));
|
||||
v8::internal::GetProperty(isolate, desc, configurable_name));
|
||||
ASSERT(!isolate->has_pending_exception());
|
||||
ASSERT(configurable->IsTrue() || configurable->IsFalse());
|
||||
if (configurable->IsFalse()) {
|
||||
@ -2680,14 +2681,16 @@ MUST_USE_RESULT MaybeObject* JSProxy::SetPropertyViaPrototypesWithHandler(
|
||||
Handle<String> hasWritable_name =
|
||||
isolate->factory()->LookupOneByteSymbol(
|
||||
STATIC_ASCII_VECTOR("hasWritable_"));
|
||||
Handle<Object> hasWritable(v8::internal::GetProperty(desc, hasWritable_name));
|
||||
Handle<Object> hasWritable(
|
||||
v8::internal::GetProperty(isolate, desc, hasWritable_name));
|
||||
ASSERT(!isolate->has_pending_exception());
|
||||
ASSERT(hasWritable->IsTrue() || hasWritable->IsFalse());
|
||||
if (hasWritable->IsTrue()) {
|
||||
Handle<String> writable_name =
|
||||
isolate->factory()->LookupOneByteSymbol(
|
||||
STATIC_ASCII_VECTOR("writable_"));
|
||||
Handle<Object> writable(v8::internal::GetProperty(desc, writable_name));
|
||||
Handle<Object> writable(
|
||||
v8::internal::GetProperty(isolate, desc, writable_name));
|
||||
ASSERT(!isolate->has_pending_exception());
|
||||
ASSERT(writable->IsTrue() || writable->IsFalse());
|
||||
*done = writable->IsFalse();
|
||||
@ -2702,7 +2705,7 @@ MUST_USE_RESULT MaybeObject* JSProxy::SetPropertyViaPrototypesWithHandler(
|
||||
// We have an AccessorDescriptor.
|
||||
Handle<String> set_name = isolate->factory()->LookupOneByteSymbol(
|
||||
STATIC_ASCII_VECTOR("set_"));
|
||||
Handle<Object> setter(v8::internal::GetProperty(desc, set_name));
|
||||
Handle<Object> setter(v8::internal::GetProperty(isolate, desc, set_name));
|
||||
ASSERT(!isolate->has_pending_exception());
|
||||
if (!setter->IsUndefined()) {
|
||||
// TODO(rossberg): nicer would be to cast to some JSCallable here...
|
||||
@ -2723,7 +2726,7 @@ MUST_USE_RESULT MaybeObject* JSProxy::DeletePropertyWithHandler(
|
||||
Isolate* isolate = GetIsolate();
|
||||
HandleScope scope(isolate);
|
||||
Handle<JSProxy> receiver(this);
|
||||
Handle<Object> name(name_raw);
|
||||
Handle<Object> name(name_raw, isolate);
|
||||
|
||||
Handle<Object> args[] = { name };
|
||||
Handle<Object> result = CallTrap(
|
||||
@ -2732,7 +2735,7 @@ MUST_USE_RESULT MaybeObject* JSProxy::DeletePropertyWithHandler(
|
||||
|
||||
Object* bool_result = result->ToBoolean();
|
||||
if (mode == STRICT_DELETION && bool_result == GetHeap()->false_value()) {
|
||||
Handle<Object> handler(receiver->handler());
|
||||
Handle<Object> handler(receiver->handler(), isolate);
|
||||
Handle<String> trap_name = isolate->factory()->LookupOneByteSymbol(
|
||||
STATIC_ASCII_VECTOR("delete"));
|
||||
Handle<Object> args[] = { handler, trap_name };
|
||||
@ -2761,9 +2764,9 @@ MUST_USE_RESULT PropertyAttributes JSProxy::GetPropertyAttributeWithHandler(
|
||||
Isolate* isolate = GetIsolate();
|
||||
HandleScope scope(isolate);
|
||||
Handle<JSProxy> proxy(this);
|
||||
Handle<Object> handler(this->handler()); // Trap might morph proxy.
|
||||
Handle<Object> handler(this->handler(), isolate); // Trap might morph proxy.
|
||||
Handle<JSReceiver> receiver(receiver_raw);
|
||||
Handle<Object> name(name_raw);
|
||||
Handle<Object> name(name_raw, isolate);
|
||||
|
||||
Handle<Object> args[] = { name };
|
||||
Handle<Object> result = CallTrap(
|
||||
@ -2782,15 +2785,15 @@ MUST_USE_RESULT PropertyAttributes JSProxy::GetPropertyAttributeWithHandler(
|
||||
// Convert result to PropertyAttributes.
|
||||
Handle<String> enum_n = isolate->factory()->LookupOneByteSymbol(
|
||||
STATIC_ASCII_VECTOR("enumerable"));
|
||||
Handle<Object> enumerable(v8::internal::GetProperty(desc, enum_n));
|
||||
Handle<Object> enumerable(v8::internal::GetProperty(isolate, desc, enum_n));
|
||||
if (isolate->has_pending_exception()) return NONE;
|
||||
Handle<String> conf_n = isolate->factory()->LookupOneByteSymbol(
|
||||
STATIC_ASCII_VECTOR("configurable"));
|
||||
Handle<Object> configurable(v8::internal::GetProperty(desc, conf_n));
|
||||
Handle<Object> configurable(v8::internal::GetProperty(isolate, desc, conf_n));
|
||||
if (isolate->has_pending_exception()) return NONE;
|
||||
Handle<String> writ_n = isolate->factory()->LookupOneByteSymbol(
|
||||
STATIC_ASCII_VECTOR("writable"));
|
||||
Handle<Object> writable(v8::internal::GetProperty(desc, writ_n));
|
||||
Handle<Object> writable(v8::internal::GetProperty(isolate, desc, writ_n));
|
||||
if (isolate->has_pending_exception()) return NONE;
|
||||
|
||||
if (configurable->IsFalse()) {
|
||||
@ -2853,10 +2856,10 @@ MUST_USE_RESULT Handle<Object> JSProxy::CallTrap(const char* name,
|
||||
int argc,
|
||||
Handle<Object> argv[]) {
|
||||
Isolate* isolate = GetIsolate();
|
||||
Handle<Object> handler(this->handler());
|
||||
Handle<Object> handler(this->handler(), isolate);
|
||||
|
||||
Handle<String> trap_name = isolate->factory()->LookupUtf8Symbol(name);
|
||||
Handle<Object> trap(v8::internal::GetProperty(handler, trap_name));
|
||||
Handle<Object> trap(v8::internal::GetProperty(isolate, handler, trap_name));
|
||||
if (isolate->has_pending_exception()) return trap;
|
||||
|
||||
if (trap->IsUndefined()) {
|
||||
@ -4155,7 +4158,7 @@ MaybeObject* JSObject::DeleteElement(uint32_t index, DeleteMode mode) {
|
||||
if (mode == STRICT_DELETION) {
|
||||
// Deleting a non-configurable property in strict mode.
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> holder(this);
|
||||
Handle<Object> holder(this, isolate);
|
||||
Handle<Object> name = isolate->factory()->NewNumberFromUint(index);
|
||||
Handle<Object> args[2] = { name, holder };
|
||||
Handle<Object> error =
|
||||
@ -4248,7 +4251,8 @@ MaybeObject* JSObject::DeleteProperty(String* name, DeleteMode mode) {
|
||||
if (mode == STRICT_DELETION) {
|
||||
// Deleting a non-configurable property in strict mode.
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> args[2] = { Handle<Object>(name), Handle<Object>(this) };
|
||||
Handle<Object> args[2] = { Handle<Object>(name, isolate),
|
||||
Handle<Object>(this, isolate) };
|
||||
return isolate->Throw(*isolate->factory()->NewTypeError(
|
||||
"strict_delete_property", HandleVector(args, 2)));
|
||||
}
|
||||
@ -4260,7 +4264,7 @@ MaybeObject* JSObject::DeleteProperty(String* name, DeleteMode mode) {
|
||||
Handle<JSObject> self(this);
|
||||
Handle<String> hname(name);
|
||||
|
||||
Handle<Object> old_value(isolate->heap()->the_hole_value());
|
||||
Handle<Object> old_value = isolate->factory()->the_hole_value();
|
||||
bool is_observed = FLAG_harmony_observation && self->map()->is_observed();
|
||||
if (is_observed && lookup.IsDataProperty()) {
|
||||
old_value = Object::GetProperty(self, hname);
|
||||
@ -4467,7 +4471,7 @@ MaybeObject* JSObject::PreventExtensions() {
|
||||
// It's not possible to seal objects with external array elements
|
||||
if (HasExternalArrayElements()) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> object(this);
|
||||
Handle<Object> object(this, isolate);
|
||||
Handle<Object> error =
|
||||
isolate->factory()->NewTypeError(
|
||||
"cant_prevent_ext_external_array_elements",
|
||||
@ -4935,8 +4939,8 @@ MaybeObject* JSObject::DefineAccessor(String* name_raw,
|
||||
HandleScope scope(isolate);
|
||||
Handle<JSObject> self(this);
|
||||
Handle<String> name(name_raw);
|
||||
Handle<Object> getter(getter_raw);
|
||||
Handle<Object> setter(setter_raw);
|
||||
Handle<Object> getter(getter_raw, isolate);
|
||||
Handle<Object> setter(setter_raw, isolate);
|
||||
|
||||
uint32_t index = 0;
|
||||
bool is_element = name->AsArrayIndex(&index);
|
||||
@ -6179,7 +6183,7 @@ Handle<Object> PolymorphicCodeCache::Lookup(MapHandleList* maps,
|
||||
if (!cache()->IsUndefined()) {
|
||||
PolymorphicCodeCacheHashTable* hash_table =
|
||||
PolymorphicCodeCacheHashTable::cast(cache());
|
||||
return Handle<Object>(hash_table->Lookup(maps, flags));
|
||||
return Handle<Object>(hash_table->Lookup(maps, flags), GetIsolate());
|
||||
} else {
|
||||
return GetIsolate()->factory()->undefined_value();
|
||||
}
|
||||
@ -9387,8 +9391,8 @@ MaybeObject* JSArray::SetElementsLength(Object* len) {
|
||||
Handle<JSArray> self(this);
|
||||
List<Handle<String> > indices;
|
||||
List<Handle<Object> > old_values;
|
||||
Handle<Object> old_length_handle(self->length());
|
||||
Handle<Object> new_length_handle(len);
|
||||
Handle<Object> old_length_handle(self->length(), isolate);
|
||||
Handle<Object> new_length_handle(len, isolate);
|
||||
uint32_t old_length = 0;
|
||||
CHECK(old_length_handle->ToArrayIndex(&old_length));
|
||||
uint32_t new_length = 0;
|
||||
@ -9903,7 +9907,7 @@ MaybeObject* JSObject::SetElementWithCallback(Object* structure,
|
||||
}
|
||||
|
||||
if (structure->IsAccessorPair()) {
|
||||
Handle<Object> setter(AccessorPair::cast(structure)->setter());
|
||||
Handle<Object> setter(AccessorPair::cast(structure)->setter(), isolate);
|
||||
if (setter->IsSpecFunction()) {
|
||||
// TODO(rossberg): nicer would be to cast to some JSCallable here...
|
||||
return SetPropertyWithDefinedSetter(JSReceiver::cast(*setter), value);
|
||||
@ -10097,7 +10101,7 @@ MaybeObject* JSObject::SetDictionaryElement(uint32_t index,
|
||||
Isolate* isolate = GetIsolate();
|
||||
Heap* heap = isolate->heap();
|
||||
Handle<JSObject> self(this);
|
||||
Handle<Object> value(value_raw);
|
||||
Handle<Object> value(value_raw, isolate);
|
||||
|
||||
// Insert element in the dictionary.
|
||||
Handle<FixedArray> elements(FixedArray::cast(this->elements()));
|
||||
@ -10126,7 +10130,7 @@ MaybeObject* JSObject::SetDictionaryElement(uint32_t index,
|
||||
if (strict_mode == kNonStrictMode) {
|
||||
return isolate->heap()->undefined_value();
|
||||
} else {
|
||||
Handle<Object> holder(this);
|
||||
Handle<Object> holder(this, isolate);
|
||||
Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
|
||||
Handle<Object> args[2] = { number, holder };
|
||||
Handle<Object> error =
|
||||
@ -10434,7 +10438,7 @@ MaybeObject* JSObject::SetElement(uint32_t index,
|
||||
|
||||
// From here on, everything has to be handlified.
|
||||
Handle<JSObject> self(this);
|
||||
Handle<Object> value(value_raw);
|
||||
Handle<Object> value(value_raw, isolate);
|
||||
PropertyAttributes old_attributes = self->GetLocalElementAttribute(index);
|
||||
Handle<Object> old_value = isolate->factory()->the_hole_value();
|
||||
Handle<Object> old_length;
|
||||
@ -11051,7 +11055,7 @@ MaybeObject* JSObject::GetPropertyWithInterceptor(
|
||||
Isolate* isolate = GetIsolate();
|
||||
InterceptorInfo* interceptor = GetNamedInterceptor();
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> receiver_handle(receiver);
|
||||
Handle<Object> receiver_handle(receiver, isolate);
|
||||
Handle<JSObject> holder_handle(this);
|
||||
Handle<String> name_handle(name);
|
||||
|
||||
@ -13642,7 +13646,8 @@ Object* DebugInfo::GetBreakPointInfo(int code_position) {
|
||||
void DebugInfo::ClearBreakPoint(Handle<DebugInfo> debug_info,
|
||||
int code_position,
|
||||
Handle<Object> break_point_object) {
|
||||
Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position));
|
||||
Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position),
|
||||
Isolate::Current());
|
||||
if (break_point_info->IsUndefined()) return;
|
||||
BreakPointInfo::ClearBreakPoint(
|
||||
Handle<BreakPointInfo>::cast(break_point_info),
|
||||
@ -13656,7 +13661,8 @@ void DebugInfo::SetBreakPoint(Handle<DebugInfo> debug_info,
|
||||
int statement_position,
|
||||
Handle<Object> break_point_object) {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position));
|
||||
Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position),
|
||||
isolate);
|
||||
if (!break_point_info->IsUndefined()) {
|
||||
BreakPointInfo::SetBreakPoint(
|
||||
Handle<BreakPointInfo>::cast(break_point_info),
|
||||
|
355
src/runtime.cc
355
src/runtime.cc
File diff suppressed because it is too large
Load Diff
@ -444,15 +444,15 @@ void ExternalReferenceTable::PopulateTable(Isolate* isolate) {
|
||||
UNCLASSIFIED,
|
||||
30,
|
||||
"TranscendentalCache::caches()");
|
||||
Add(ExternalReference::handle_scope_next_address().address(),
|
||||
Add(ExternalReference::handle_scope_next_address(isolate).address(),
|
||||
UNCLASSIFIED,
|
||||
31,
|
||||
"HandleScope::next");
|
||||
Add(ExternalReference::handle_scope_limit_address().address(),
|
||||
Add(ExternalReference::handle_scope_limit_address(isolate).address(),
|
||||
UNCLASSIFIED,
|
||||
32,
|
||||
"HandleScope::limit");
|
||||
Add(ExternalReference::handle_scope_level_address().address(),
|
||||
Add(ExternalReference::handle_scope_level_address(isolate).address(),
|
||||
UNCLASSIFIED,
|
||||
33,
|
||||
"HandleScope::level");
|
||||
|
@ -114,7 +114,7 @@ Handle<Code> StubCache::ComputeLoadNonexistent(Handle<String> name,
|
||||
Handle<GlobalObject> global;
|
||||
do {
|
||||
current = Handle<JSObject>::cast(next);
|
||||
next = Handle<Object>(current->GetPrototype());
|
||||
next = Handle<Object>(current->GetPrototype(), isolate_);
|
||||
if (current->IsGlobalObject()) {
|
||||
global = Handle<GlobalObject>::cast(current);
|
||||
cache_name = name;
|
||||
|
@ -1135,7 +1135,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
Handle<JSGlobalPropertyCell> cell =
|
||||
isolate()->factory()->NewJSGlobalPropertyCell(
|
||||
Handle<Object>(
|
||||
Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker)));
|
||||
Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker),
|
||||
isolate()));
|
||||
RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell);
|
||||
__ LoadHeapObject(rbx, cell);
|
||||
__ Move(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset),
|
||||
|
@ -5187,7 +5187,8 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
|
||||
// Copy in-object properties.
|
||||
for (int i = 0; i < inobject_properties; i++) {
|
||||
int total_offset = object_offset + object->GetInObjectPropertyOffset(i);
|
||||
Handle<Object> value = Handle<Object>(object->InObjectPropertyAt(i));
|
||||
Handle<Object> value = Handle<Object>(object->InObjectPropertyAt(i),
|
||||
isolate());
|
||||
if (value->IsJSObject()) {
|
||||
Handle<JSObject> value_object = Handle<JSObject>::cast(value);
|
||||
__ lea(rcx, Operand(result, *offset));
|
||||
@ -5235,7 +5236,7 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
|
||||
Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements);
|
||||
for (int i = 0; i < elements_length; i++) {
|
||||
int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i);
|
||||
Handle<Object> value(fast_elements->get(i));
|
||||
Handle<Object> value(fast_elements->get(i), isolate());
|
||||
if (value->IsJSObject()) {
|
||||
Handle<JSObject> value_object = Handle<JSObject>::cast(value);
|
||||
__ lea(rcx, Operand(result, *offset));
|
||||
|
@ -701,13 +701,13 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address,
|
||||
|
||||
Factory* factory = isolate()->factory();
|
||||
ExternalReference next_address =
|
||||
ExternalReference::handle_scope_next_address();
|
||||
ExternalReference::handle_scope_next_address(isolate());
|
||||
const int kNextOffset = 0;
|
||||
const int kLimitOffset = Offset(
|
||||
ExternalReference::handle_scope_limit_address(),
|
||||
ExternalReference::handle_scope_limit_address(isolate()),
|
||||
next_address);
|
||||
const int kLevelOffset = Offset(
|
||||
ExternalReference::handle_scope_level_address(),
|
||||
ExternalReference::handle_scope_level_address(isolate()),
|
||||
next_address);
|
||||
ExternalReference scheduled_exception_address =
|
||||
ExternalReference::scheduled_exception_address(isolate());
|
||||
|
@ -472,7 +472,7 @@ static void GenerateFastApiCall(MacroAssembler* masm,
|
||||
// Pass the additional arguments.
|
||||
__ movq(Operand(rsp, 2 * kPointerSize), rdi);
|
||||
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
|
||||
Handle<Object> call_data(api_call_info->data());
|
||||
Handle<Object> call_data(api_call_info->data(), masm->isolate());
|
||||
if (masm->isolate()->heap()->InNewSpace(*call_data)) {
|
||||
__ Move(rcx, api_call_info);
|
||||
__ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset));
|
||||
@ -1120,7 +1120,7 @@ void StubCompiler::GenerateLoadCallback(Handle<JSObject> object,
|
||||
__ Move(scratch1, callback);
|
||||
__ push(FieldOperand(scratch1, ExecutableAccessorInfo::kDataOffset));
|
||||
} else {
|
||||
__ Push(Handle<Object>(callback->data()));
|
||||
__ Push(Handle<Object>(callback->data(), isolate()));
|
||||
}
|
||||
__ PushAddress(ExternalReference::isolate_address()); // isolate
|
||||
__ push(name_reg); // name
|
||||
@ -3115,7 +3115,8 @@ Handle<Code> ConstructStubCompiler::CompileConstructStub(
|
||||
__ movq(Operand(r9, i * kPointerSize), rbx);
|
||||
} else {
|
||||
// Set the property to the constant value.
|
||||
Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i));
|
||||
Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i),
|
||||
isolate());
|
||||
__ Move(Operand(r9, i * kPointerSize), constant);
|
||||
}
|
||||
}
|
||||
|
@ -225,7 +225,8 @@ THREADED_TEST(HandleScopePop) {
|
||||
LocalContext context;
|
||||
v8::Handle<v8::Object> inst = obj->NewInstance();
|
||||
context->Global()->Set(v8::String::New("obj"), inst);
|
||||
int count_before = i::HandleScope::NumberOfHandles();
|
||||
i::Isolate* isolate = i::Isolate::Current();
|
||||
int count_before = i::HandleScope::NumberOfHandles(isolate);
|
||||
{
|
||||
v8::HandleScope scope;
|
||||
CompileRun(
|
||||
@ -234,7 +235,7 @@ THREADED_TEST(HandleScopePop) {
|
||||
" obj.many;"
|
||||
"}");
|
||||
}
|
||||
int count_after = i::HandleScope::NumberOfHandles();
|
||||
int count_after = i::HandleScope::NumberOfHandles(isolate);
|
||||
CHECK_EQ(count_before, count_after);
|
||||
}
|
||||
|
||||
|
@ -13572,7 +13572,8 @@ THREADED_TEST(PixelArray) {
|
||||
"sum;");
|
||||
CHECK_EQ(28, result->Int32Value());
|
||||
|
||||
i::Handle<i::Smi> value(i::Smi::FromInt(2));
|
||||
i::Handle<i::Smi> value(i::Smi::FromInt(2),
|
||||
reinterpret_cast<i::Isolate*>(context->GetIsolate()));
|
||||
i::Handle<i::Object> no_failure;
|
||||
no_failure =
|
||||
i::JSObject::SetElement(jsobj, 1, value, NONE, i::kNonStrictMode);
|
||||
|
@ -59,17 +59,18 @@ TEST(0) {
|
||||
InitializeVM();
|
||||
v8::HandleScope scope;
|
||||
|
||||
Assembler assm(Isolate::Current(), NULL, 0);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, NULL, 0);
|
||||
|
||||
__ add(r0, r0, Operand(r1));
|
||||
__ mov(pc, Operand(lr));
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef DEBUG
|
||||
Code::cast(code)->Print();
|
||||
@ -85,7 +86,8 @@ TEST(1) {
|
||||
InitializeVM();
|
||||
v8::HandleScope scope;
|
||||
|
||||
Assembler assm(Isolate::Current(), NULL, 0);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, NULL, 0);
|
||||
Label L, C;
|
||||
|
||||
__ mov(r1, Operand(r0));
|
||||
@ -103,10 +105,10 @@ TEST(1) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef DEBUG
|
||||
Code::cast(code)->Print();
|
||||
@ -122,7 +124,8 @@ TEST(2) {
|
||||
InitializeVM();
|
||||
v8::HandleScope scope;
|
||||
|
||||
Assembler assm(Isolate::Current(), NULL, 0);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, NULL, 0);
|
||||
Label L, C;
|
||||
|
||||
__ mov(r1, Operand(r0));
|
||||
@ -149,10 +152,10 @@ TEST(2) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef DEBUG
|
||||
Code::cast(code)->Print();
|
||||
@ -175,7 +178,8 @@ TEST(3) {
|
||||
} T;
|
||||
T t;
|
||||
|
||||
Assembler assm(Isolate::Current(), NULL, 0);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, NULL, 0);
|
||||
Label L, C;
|
||||
|
||||
__ mov(ip, Operand(sp));
|
||||
@ -197,10 +201,10 @@ TEST(3) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef DEBUG
|
||||
Code::cast(code)->Print();
|
||||
@ -242,7 +246,8 @@ TEST(4) {
|
||||
|
||||
// Create a function that accepts &t, and loads, manipulates, and stores
|
||||
// the doubles and floats.
|
||||
Assembler assm(Isolate::Current(), NULL, 0);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, NULL, 0);
|
||||
Label L, C;
|
||||
|
||||
|
||||
@ -314,10 +319,10 @@ TEST(4) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef DEBUG
|
||||
Code::cast(code)->Print();
|
||||
@ -360,7 +365,8 @@ TEST(5) {
|
||||
InitializeVM();
|
||||
v8::HandleScope scope;
|
||||
|
||||
Assembler assm(Isolate::Current(), NULL, 0);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, NULL, 0);
|
||||
|
||||
if (CpuFeatures::IsSupported(ARMv7)) {
|
||||
CpuFeatures::Scope scope(ARMv7);
|
||||
@ -374,10 +380,10 @@ TEST(5) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef DEBUG
|
||||
Code::cast(code)->Print();
|
||||
@ -396,7 +402,8 @@ TEST(6) {
|
||||
InitializeVM();
|
||||
v8::HandleScope scope;
|
||||
|
||||
Assembler assm(Isolate::Current(), NULL, 0);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, NULL, 0);
|
||||
|
||||
if (CpuFeatures::IsSupported(ARMv7)) {
|
||||
CpuFeatures::Scope scope(ARMv7);
|
||||
@ -409,10 +416,10 @@ TEST(6) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef DEBUG
|
||||
Code::cast(code)->Print();
|
||||
@ -439,7 +446,8 @@ static void TestRoundingMode(VCVTTypes types,
|
||||
InitializeVM();
|
||||
v8::HandleScope scope;
|
||||
|
||||
Assembler assm(Isolate::Current(), NULL, 0);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, NULL, 0);
|
||||
|
||||
if (CpuFeatures::IsSupported(VFP3)) {
|
||||
CpuFeatures::Scope scope(VFP3);
|
||||
@ -485,10 +493,10 @@ static void TestRoundingMode(VCVTTypes types,
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef DEBUG
|
||||
Code::cast(code)->Print();
|
||||
@ -642,7 +650,8 @@ TEST(8) {
|
||||
|
||||
// Create a function that uses vldm/vstm to move some double and
|
||||
// single precision values around in memory.
|
||||
Assembler assm(Isolate::Current(), NULL, 0);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, NULL, 0);
|
||||
|
||||
if (CpuFeatures::IsSupported(VFP2)) {
|
||||
CpuFeatures::Scope scope(VFP2);
|
||||
@ -671,10 +680,10 @@ TEST(8) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef DEBUG
|
||||
Code::cast(code)->Print();
|
||||
@ -753,7 +762,8 @@ TEST(9) {
|
||||
|
||||
// Create a function that uses vldm/vstm to move some double and
|
||||
// single precision values around in memory.
|
||||
Assembler assm(Isolate::Current(), NULL, 0);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, NULL, 0);
|
||||
|
||||
if (CpuFeatures::IsSupported(VFP2)) {
|
||||
CpuFeatures::Scope scope(VFP2);
|
||||
@ -786,10 +796,10 @@ TEST(9) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef DEBUG
|
||||
Code::cast(code)->Print();
|
||||
@ -868,7 +878,8 @@ TEST(10) {
|
||||
|
||||
// Create a function that uses vldm/vstm to move some double and
|
||||
// single precision values around in memory.
|
||||
Assembler assm(Isolate::Current(), NULL, 0);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, NULL, 0);
|
||||
|
||||
if (CpuFeatures::IsSupported(VFP2)) {
|
||||
CpuFeatures::Scope scope(VFP2);
|
||||
@ -897,10 +908,10 @@ TEST(10) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef DEBUG
|
||||
Code::cast(code)->Print();
|
||||
@ -964,7 +975,8 @@ TEST(11) {
|
||||
i.a = 0xabcd0001;
|
||||
i.b = 0xabcd0000;
|
||||
|
||||
Assembler assm(Isolate::Current(), NULL, 0);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, NULL, 0);
|
||||
|
||||
// Test HeapObject untagging.
|
||||
__ ldr(r1, MemOperand(r0, OFFSET_OF(I, a)));
|
||||
@ -994,10 +1006,10 @@ TEST(11) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef DEBUG
|
||||
Code::cast(code)->Print();
|
||||
@ -1051,7 +1063,8 @@ TEST(13) {
|
||||
|
||||
// Create a function that accepts &t, and loads, manipulates, and stores
|
||||
// the doubles and floats.
|
||||
Assembler assm(Isolate::Current(), NULL, 0);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, NULL, 0);
|
||||
Label L, C;
|
||||
|
||||
|
||||
@ -1115,10 +1128,10 @@ TEST(13) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef DEBUG
|
||||
Code::cast(code)->Print();
|
||||
|
@ -61,7 +61,8 @@ TEST(AssemblerIa320) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
v8::internal::byte buffer[256];
|
||||
Assembler assm(Isolate::Current(), buffer, sizeof buffer);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, buffer, sizeof buffer);
|
||||
|
||||
__ mov(eax, Operand(esp, 4));
|
||||
__ add(eax, Operand(esp, 8));
|
||||
@ -69,10 +70,10 @@ TEST(AssemblerIa320) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef OBJECT_PRINT
|
||||
Code::cast(code)->Print();
|
||||
@ -89,7 +90,8 @@ TEST(AssemblerIa321) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
v8::internal::byte buffer[256];
|
||||
Assembler assm(Isolate::Current(), buffer, sizeof buffer);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, buffer, sizeof buffer);
|
||||
Label L, C;
|
||||
|
||||
__ mov(edx, Operand(esp, 4));
|
||||
@ -107,10 +109,10 @@ TEST(AssemblerIa321) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef OBJECT_PRINT
|
||||
Code::cast(code)->Print();
|
||||
@ -127,7 +129,8 @@ TEST(AssemblerIa322) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
v8::internal::byte buffer[256];
|
||||
Assembler assm(Isolate::Current(), buffer, sizeof buffer);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, buffer, sizeof buffer);
|
||||
Label L, C;
|
||||
|
||||
__ mov(edx, Operand(esp, 4));
|
||||
@ -149,10 +152,10 @@ TEST(AssemblerIa322) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef OBJECT_PRINT
|
||||
Code::cast(code)->Print();
|
||||
@ -173,7 +176,8 @@ TEST(AssemblerIa323) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
v8::internal::byte buffer[256];
|
||||
Assembler assm(Isolate::Current(), buffer, sizeof buffer);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, buffer, sizeof buffer);
|
||||
|
||||
CHECK(CpuFeatures::IsSupported(SSE2));
|
||||
{ CpuFeatures::Scope fscope(SSE2);
|
||||
@ -183,10 +187,10 @@ TEST(AssemblerIa323) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Code* code = Code::cast(HEAP->CreateCode(
|
||||
Code* code = Code::cast(isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked());
|
||||
Handle<Code>())->ToObjectChecked());
|
||||
// don't print the code - our disassembler can't handle cvttss2si
|
||||
// instead print bytes
|
||||
Disassembler::Dump(stdout,
|
||||
@ -208,7 +212,8 @@ TEST(AssemblerIa324) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
v8::internal::byte buffer[256];
|
||||
Assembler assm(Isolate::Current(), buffer, sizeof buffer);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, buffer, sizeof buffer);
|
||||
|
||||
CHECK(CpuFeatures::IsSupported(SSE2));
|
||||
CpuFeatures::Scope fscope(SSE2);
|
||||
@ -217,10 +222,10 @@ TEST(AssemblerIa324) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Code* code = Code::cast(HEAP->CreateCode(
|
||||
Code* code = Code::cast(isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked());
|
||||
Handle<Code>())->ToObjectChecked());
|
||||
// don't print the code - our disassembler can't handle cvttsd2si
|
||||
// instead print bytes
|
||||
Disassembler::Dump(stdout,
|
||||
@ -239,17 +244,18 @@ TEST(AssemblerIa325) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
v8::internal::byte buffer[256];
|
||||
Assembler assm(Isolate::Current(), buffer, sizeof buffer);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, buffer, sizeof buffer);
|
||||
|
||||
__ mov(eax, Operand(reinterpret_cast<intptr_t>(&baz), RelocInfo::NONE32));
|
||||
__ ret(0);
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Code* code = Code::cast(HEAP->CreateCode(
|
||||
Code* code = Code::cast(isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked());
|
||||
Handle<Code>())->ToObjectChecked());
|
||||
F0 f = FUNCTION_CAST<F0>(code->entry());
|
||||
int res = f();
|
||||
CHECK_EQ(42, res);
|
||||
@ -266,7 +272,8 @@ TEST(AssemblerIa326) {
|
||||
CHECK(CpuFeatures::IsSupported(SSE2));
|
||||
CpuFeatures::Scope fscope(SSE2);
|
||||
v8::internal::byte buffer[256];
|
||||
Assembler assm(Isolate::Current(), buffer, sizeof buffer);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, buffer, sizeof buffer);
|
||||
|
||||
__ movdbl(xmm0, Operand(esp, 1 * kPointerSize));
|
||||
__ movdbl(xmm1, Operand(esp, 3 * kPointerSize));
|
||||
@ -283,10 +290,10 @@ TEST(AssemblerIa326) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Code* code = Code::cast(HEAP->CreateCode(
|
||||
Code* code = Code::cast(isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked());
|
||||
Handle<Code>())->ToObjectChecked());
|
||||
#ifdef DEBUG
|
||||
::printf("\n---\n");
|
||||
// don't print the code - our disassembler can't handle SSE instructions
|
||||
@ -312,7 +319,8 @@ TEST(AssemblerIa328) {
|
||||
CHECK(CpuFeatures::IsSupported(SSE2));
|
||||
CpuFeatures::Scope fscope(SSE2);
|
||||
v8::internal::byte buffer[256];
|
||||
Assembler assm(Isolate::Current(), buffer, sizeof buffer);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, buffer, sizeof buffer);
|
||||
__ mov(eax, Operand(esp, 4));
|
||||
__ cvtsi2sd(xmm0, eax);
|
||||
// Copy xmm0 to st(0) using eight bytes of stack.
|
||||
@ -323,10 +331,10 @@ TEST(AssemblerIa328) {
|
||||
__ ret(0);
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Code* code = Code::cast(HEAP->CreateCode(
|
||||
Code* code = Code::cast(isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked());
|
||||
Handle<Code>())->ToObjectChecked());
|
||||
CHECK(code->IsCode());
|
||||
#ifdef OBJECT_PRINT
|
||||
Code::cast(code)->Print();
|
||||
@ -345,7 +353,8 @@ TEST(AssemblerIa329) {
|
||||
InitializeVM();
|
||||
v8::HandleScope scope;
|
||||
v8::internal::byte buffer[256];
|
||||
MacroAssembler assm(Isolate::Current(), buffer, sizeof buffer);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
MacroAssembler assm(isolate, buffer, sizeof buffer);
|
||||
enum { kEqual = 0, kGreater = 1, kLess = 2, kNaN = 3, kUndefined = 4 };
|
||||
Label equal_l, less_l, greater_l, nan_l;
|
||||
__ fld_d(Operand(esp, 3 * kPointerSize));
|
||||
@ -378,10 +387,10 @@ TEST(AssemblerIa329) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Code* code = Code::cast(HEAP->CreateCode(
|
||||
Code* code = Code::cast(isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked());
|
||||
Handle<Code>())->ToObjectChecked());
|
||||
CHECK(code->IsCode());
|
||||
#ifdef OBJECT_PRINT
|
||||
Code::cast(code)->Print();
|
||||
@ -399,7 +408,8 @@ TEST(AssemblerIa3210) {
|
||||
// Test chaining of label usages within instructions (issue 1644).
|
||||
InitializeVM();
|
||||
v8::HandleScope scope;
|
||||
Assembler assm(Isolate::Current(), NULL, 0);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, NULL, 0);
|
||||
|
||||
Label target;
|
||||
__ j(equal, &target);
|
||||
@ -413,7 +423,8 @@ TEST(AssemblerMultiByteNop) {
|
||||
InitializeVM();
|
||||
v8::HandleScope scope;
|
||||
v8::internal::byte buffer[1024];
|
||||
Assembler assm(Isolate::Current(), buffer, sizeof(buffer));
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, buffer, sizeof(buffer));
|
||||
__ push(ebx);
|
||||
__ push(ecx);
|
||||
__ push(edx);
|
||||
@ -462,10 +473,10 @@ TEST(AssemblerMultiByteNop) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Code* code = Code::cast(HEAP->CreateCode(
|
||||
Code* code = Code::cast(isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked());
|
||||
Handle<Code>())->ToObjectChecked());
|
||||
CHECK(code->IsCode());
|
||||
|
||||
F0 f = FUNCTION_CAST<F0>(code->entry());
|
||||
|
@ -76,7 +76,7 @@ TEST(MIPS0) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry());
|
||||
int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0));
|
||||
@ -114,7 +114,7 @@ TEST(MIPS1) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry());
|
||||
int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 50, 0, 0, 0, 0));
|
||||
@ -254,7 +254,7 @@ TEST(MIPS2) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry());
|
||||
int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0));
|
||||
@ -329,7 +329,7 @@ TEST(MIPS3) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry());
|
||||
t.a = 1.5e14;
|
||||
@ -398,7 +398,7 @@ TEST(MIPS4) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry());
|
||||
t.a = 1.5e22;
|
||||
@ -467,7 +467,7 @@ TEST(MIPS5) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry());
|
||||
t.a = 1.5e4;
|
||||
@ -540,7 +540,7 @@ TEST(MIPS6) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry());
|
||||
t.ui = 0x11223344;
|
||||
@ -619,7 +619,7 @@ TEST(MIPS7) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry());
|
||||
t.a = 1.5e14;
|
||||
@ -718,7 +718,7 @@ TEST(MIPS8) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry());
|
||||
t.input = 0x12345678;
|
||||
@ -765,7 +765,7 @@ TEST(MIPS9) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
}
|
||||
|
||||
@ -826,7 +826,7 @@ TEST(MIPS10) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry());
|
||||
t.a = 2.147483647e9; // 0x7fffffff -> 0x41DFFFFFFFC00000 as double.
|
||||
@ -958,7 +958,7 @@ TEST(MIPS11) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry());
|
||||
t.reg_init = 0xaabbccdd;
|
||||
@ -1062,7 +1062,7 @@ TEST(MIPS12) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry());
|
||||
t.x = 1;
|
||||
@ -1121,7 +1121,7 @@ TEST(MIPS13) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry());
|
||||
|
||||
@ -1245,7 +1245,7 @@ TEST(MIPS14) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry());
|
||||
|
||||
|
@ -376,7 +376,8 @@ TEST(AssemblerMultiByteNop) {
|
||||
InitializeVM();
|
||||
v8::HandleScope scope;
|
||||
v8::internal::byte buffer[1024];
|
||||
Assembler assm(Isolate::Current(), buffer, sizeof(buffer));
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Assembler assm(isolate, buffer, sizeof(buffer));
|
||||
__ push(rbx);
|
||||
__ push(rcx);
|
||||
__ push(rdx);
|
||||
@ -425,11 +426,10 @@ TEST(AssemblerMultiByteNop) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Code* code = Code::cast(HEAP->CreateCode(
|
||||
Code* code = Code::cast(isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
v8::internal::Handle<v8::internal::Object>(
|
||||
HEAP->undefined_value()))->ToObjectChecked());
|
||||
v8::internal::Handle<Code>())->ToObjectChecked());
|
||||
CHECK(code->IsCode());
|
||||
|
||||
F0 f = FUNCTION_CAST<F0>(code->entry());
|
||||
|
@ -101,9 +101,9 @@ static MaybeObject* GetGlobalProperty(const char* name) {
|
||||
|
||||
static void SetGlobalProperty(const char* name, Object* value) {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Handle<Object> object(value);
|
||||
Handle<String> symbol = FACTORY->LookupUtf8Symbol(name);
|
||||
Handle<JSObject> global(Isolate::Current()->context()->global_object());
|
||||
Handle<Object> object(value, isolate);
|
||||
Handle<String> symbol = isolate->factory()->LookupUtf8Symbol(name);
|
||||
Handle<JSObject> global(isolate->context()->global_object());
|
||||
SetProperty(isolate, global, symbol, object, NONE, kNonStrictMode);
|
||||
}
|
||||
|
||||
@ -265,11 +265,11 @@ TEST(UncaughtThrow) {
|
||||
Handle<JSFunction> fun = Compile(source);
|
||||
CHECK(!fun.is_null());
|
||||
bool has_pending_exception;
|
||||
Handle<JSObject> global(Isolate::Current()->context()->global_object());
|
||||
Isolate* isolate = fun->GetIsolate();
|
||||
Handle<JSObject> global(isolate->context()->global_object());
|
||||
Execution::Call(fun, global, 0, NULL, &has_pending_exception);
|
||||
CHECK(has_pending_exception);
|
||||
CHECK_EQ(42.0, Isolate::Current()->pending_exception()->
|
||||
ToObjectChecked()->Number());
|
||||
CHECK_EQ(42.0, isolate->pending_exception()->ToObjectChecked()->Number());
|
||||
}
|
||||
|
||||
|
||||
@ -287,6 +287,7 @@ TEST(C2JSFrames) {
|
||||
|
||||
Handle<JSFunction> fun0 = Compile(source);
|
||||
CHECK(!fun0.is_null());
|
||||
Isolate* isolate = fun0->GetIsolate();
|
||||
|
||||
// Run the generated code to populate the global object with 'foo'.
|
||||
bool has_pending_exception;
|
||||
@ -297,9 +298,9 @@ TEST(C2JSFrames) {
|
||||
Object* foo_symbol =
|
||||
FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("foo"))->
|
||||
ToObjectChecked();
|
||||
MaybeObject* fun1_object = Isolate::Current()->context()->global_object()->
|
||||
MaybeObject* fun1_object = isolate->context()->global_object()->
|
||||
GetProperty(String::cast(foo_symbol));
|
||||
Handle<Object> fun1(fun1_object->ToObjectChecked());
|
||||
Handle<Object> fun1(fun1_object->ToObjectChecked(), isolate);
|
||||
CHECK(fun1->IsJSFunction());
|
||||
|
||||
Handle<Object> argv[] =
|
||||
|
@ -143,7 +143,8 @@ class DebugLocalContext {
|
||||
inline v8::Context* operator*() { return *context_; }
|
||||
inline bool IsReady() { return !context_.IsEmpty(); }
|
||||
void ExposeDebug() {
|
||||
v8::internal::Isolate* isolate = v8::internal::Isolate::Current();
|
||||
v8::internal::Isolate* isolate =
|
||||
reinterpret_cast<v8::internal::Isolate*>(context_->GetIsolate());
|
||||
v8::internal::Debug* debug = isolate->debug();
|
||||
// Expose the debug context global object in the global object for testing.
|
||||
debug->Load();
|
||||
@ -155,8 +156,9 @@ class DebugLocalContext {
|
||||
Handle<v8::internal::String> debug_string =
|
||||
FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("debug"));
|
||||
SetProperty(isolate, global, debug_string,
|
||||
Handle<Object>(debug->debug_context()->global_proxy()), DONT_ENUM,
|
||||
::v8::internal::kNonStrictMode);
|
||||
Handle<Object>(debug->debug_context()->global_proxy(), isolate),
|
||||
DONT_ENUM,
|
||||
::v8::internal::kNonStrictMode);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -198,10 +200,11 @@ static bool HasDebugInfo(v8::Handle<v8::Function> fun) {
|
||||
// number.
|
||||
static int SetBreakPoint(Handle<v8::internal::JSFunction> fun, int position) {
|
||||
static int break_point = 0;
|
||||
v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug();
|
||||
v8::internal::Isolate* isolate = fun->GetIsolate();
|
||||
v8::internal::Debug* debug = isolate->debug();
|
||||
debug->SetBreakPoint(
|
||||
fun,
|
||||
Handle<Object>(v8::internal::Smi::FromInt(++break_point)),
|
||||
Handle<Object>(v8::internal::Smi::FromInt(++break_point), isolate),
|
||||
&position);
|
||||
return break_point;
|
||||
}
|
||||
@ -282,9 +285,10 @@ static int SetScriptBreakPointByNameFromJS(const char* script_name,
|
||||
|
||||
// Clear a break point.
|
||||
static void ClearBreakPoint(int break_point) {
|
||||
v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug();
|
||||
v8::internal::Isolate* isolate = v8::internal::Isolate::Current();
|
||||
v8::internal::Debug* debug = isolate->debug();
|
||||
debug->ClearBreakPoint(
|
||||
Handle<Object>(v8::internal::Smi::FromInt(break_point)));
|
||||
Handle<Object>(v8::internal::Smi::FromInt(break_point), isolate));
|
||||
}
|
||||
|
||||
|
||||
|
@ -459,10 +459,11 @@ TEST(DisasmIa320) {
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Object* code = isolate->heap()->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef OBJECT_PRINT
|
||||
Code::cast(code)->Print();
|
||||
|
@ -417,7 +417,7 @@ TEST(DisasmX64) {
|
||||
Object* code = HEAP->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
#ifdef OBJECT_PRINT
|
||||
Code::cast(code)->Print();
|
||||
|
@ -1302,9 +1302,10 @@ TEST(NoHandleLeaks) {
|
||||
CompileRun("document = { URL:\"abcdefgh\" };");
|
||||
|
||||
v8::Handle<v8::String> name(v8_str("leakz"));
|
||||
int count_before = i::HandleScope::NumberOfHandles();
|
||||
i::Isolate* isolate = i::Isolate::Current();
|
||||
int count_before = i::HandleScope::NumberOfHandles(isolate);
|
||||
v8::HeapProfiler::TakeSnapshot(name);
|
||||
int count_after = i::HandleScope::NumberOfHandles();
|
||||
int count_after = i::HandleScope::NumberOfHandles(isolate);
|
||||
CHECK_EQ(count_before, count_after);
|
||||
}
|
||||
|
||||
|
@ -58,62 +58,65 @@ TEST(HeapMaps) {
|
||||
}
|
||||
|
||||
|
||||
static void CheckOddball(Object* obj, const char* string) {
|
||||
static void CheckOddball(Isolate* isolate, Object* obj, const char* string) {
|
||||
CHECK(obj->IsOddball());
|
||||
bool exc;
|
||||
Object* print_string = *Execution::ToString(Handle<Object>(obj), &exc);
|
||||
Object* print_string =
|
||||
*Execution::ToString(Handle<Object>(obj, isolate), &exc);
|
||||
CHECK(String::cast(print_string)->IsUtf8EqualTo(CStrVector(string)));
|
||||
}
|
||||
|
||||
|
||||
static void CheckSmi(int value, const char* string) {
|
||||
static void CheckSmi(Isolate* isolate, int value, const char* string) {
|
||||
bool exc;
|
||||
Object* print_string =
|
||||
*Execution::ToString(Handle<Object>(Smi::FromInt(value)), &exc);
|
||||
*Execution::ToString(Handle<Object>(Smi::FromInt(value), isolate), &exc);
|
||||
CHECK(String::cast(print_string)->IsUtf8EqualTo(CStrVector(string)));
|
||||
}
|
||||
|
||||
|
||||
static void CheckNumber(double value, const char* string) {
|
||||
static void CheckNumber(Isolate* isolate, double value, const char* string) {
|
||||
Object* obj = HEAP->NumberFromDouble(value)->ToObjectChecked();
|
||||
CHECK(obj->IsNumber());
|
||||
bool exc;
|
||||
Object* print_string = *Execution::ToString(Handle<Object>(obj), &exc);
|
||||
Object* print_string =
|
||||
*Execution::ToString(Handle<Object>(obj, isolate), &exc);
|
||||
CHECK(String::cast(print_string)->IsUtf8EqualTo(CStrVector(string)));
|
||||
}
|
||||
|
||||
|
||||
static void CheckFindCodeObject() {
|
||||
static void CheckFindCodeObject(Isolate* isolate) {
|
||||
// Test FindCodeObject
|
||||
#define __ assm.
|
||||
|
||||
Assembler assm(Isolate::Current(), NULL, 0);
|
||||
Assembler assm(isolate, NULL, 0);
|
||||
|
||||
__ nop(); // supported on all architectures
|
||||
|
||||
CodeDesc desc;
|
||||
assm.GetCode(&desc);
|
||||
Object* code = HEAP->CreateCode(
|
||||
Heap* heap = isolate->heap();
|
||||
Object* code = heap->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(code->IsCode());
|
||||
|
||||
HeapObject* obj = HeapObject::cast(code);
|
||||
Address obj_addr = obj->address();
|
||||
|
||||
for (int i = 0; i < obj->Size(); i += kPointerSize) {
|
||||
Object* found = HEAP->FindCodeObject(obj_addr + i);
|
||||
Object* found = heap->FindCodeObject(obj_addr + i);
|
||||
CHECK_EQ(code, found);
|
||||
}
|
||||
|
||||
Object* copy = HEAP->CreateCode(
|
||||
Object* copy = heap->CreateCode(
|
||||
desc,
|
||||
Code::ComputeFlags(Code::STUB),
|
||||
Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
|
||||
Handle<Code>())->ToObjectChecked();
|
||||
CHECK(copy->IsCode());
|
||||
HeapObject* obj_copy = HeapObject::cast(copy);
|
||||
Object* not_right = HEAP->FindCodeObject(obj_copy->address() +
|
||||
Object* not_right = heap->FindCodeObject(obj_copy->address() +
|
||||
obj_copy->Size() / 2);
|
||||
CHECK(not_right != code);
|
||||
}
|
||||
@ -121,50 +124,52 @@ static void CheckFindCodeObject() {
|
||||
|
||||
TEST(HeapObjects) {
|
||||
InitializeVM();
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Heap* heap = isolate->heap();
|
||||
|
||||
v8::HandleScope sc;
|
||||
Object* value = HEAP->NumberFromDouble(1.000123)->ToObjectChecked();
|
||||
Object* value = heap->NumberFromDouble(1.000123)->ToObjectChecked();
|
||||
CHECK(value->IsHeapNumber());
|
||||
CHECK(value->IsNumber());
|
||||
CHECK_EQ(1.000123, value->Number());
|
||||
|
||||
value = HEAP->NumberFromDouble(1.0)->ToObjectChecked();
|
||||
value = heap->NumberFromDouble(1.0)->ToObjectChecked();
|
||||
CHECK(value->IsSmi());
|
||||
CHECK(value->IsNumber());
|
||||
CHECK_EQ(1.0, value->Number());
|
||||
|
||||
value = HEAP->NumberFromInt32(1024)->ToObjectChecked();
|
||||
value = heap->NumberFromInt32(1024)->ToObjectChecked();
|
||||
CHECK(value->IsSmi());
|
||||
CHECK(value->IsNumber());
|
||||
CHECK_EQ(1024.0, value->Number());
|
||||
|
||||
value = HEAP->NumberFromInt32(Smi::kMinValue)->ToObjectChecked();
|
||||
value = heap->NumberFromInt32(Smi::kMinValue)->ToObjectChecked();
|
||||
CHECK(value->IsSmi());
|
||||
CHECK(value->IsNumber());
|
||||
CHECK_EQ(Smi::kMinValue, Smi::cast(value)->value());
|
||||
|
||||
value = HEAP->NumberFromInt32(Smi::kMaxValue)->ToObjectChecked();
|
||||
value = heap->NumberFromInt32(Smi::kMaxValue)->ToObjectChecked();
|
||||
CHECK(value->IsSmi());
|
||||
CHECK(value->IsNumber());
|
||||
CHECK_EQ(Smi::kMaxValue, Smi::cast(value)->value());
|
||||
|
||||
#ifndef V8_TARGET_ARCH_X64
|
||||
// TODO(lrn): We need a NumberFromIntptr function in order to test this.
|
||||
value = HEAP->NumberFromInt32(Smi::kMinValue - 1)->ToObjectChecked();
|
||||
value = heap->NumberFromInt32(Smi::kMinValue - 1)->ToObjectChecked();
|
||||
CHECK(value->IsHeapNumber());
|
||||
CHECK(value->IsNumber());
|
||||
CHECK_EQ(static_cast<double>(Smi::kMinValue - 1), value->Number());
|
||||
#endif
|
||||
|
||||
MaybeObject* maybe_value =
|
||||
HEAP->NumberFromUint32(static_cast<uint32_t>(Smi::kMaxValue) + 1);
|
||||
heap->NumberFromUint32(static_cast<uint32_t>(Smi::kMaxValue) + 1);
|
||||
value = maybe_value->ToObjectChecked();
|
||||
CHECK(value->IsHeapNumber());
|
||||
CHECK(value->IsNumber());
|
||||
CHECK_EQ(static_cast<double>(static_cast<uint32_t>(Smi::kMaxValue) + 1),
|
||||
value->Number());
|
||||
|
||||
maybe_value = HEAP->NumberFromUint32(static_cast<uint32_t>(1) << 31);
|
||||
maybe_value = heap->NumberFromUint32(static_cast<uint32_t>(1) << 31);
|
||||
value = maybe_value->ToObjectChecked();
|
||||
CHECK(value->IsHeapNumber());
|
||||
CHECK(value->IsNumber());
|
||||
@ -172,33 +177,33 @@ TEST(HeapObjects) {
|
||||
value->Number());
|
||||
|
||||
// nan oddball checks
|
||||
CHECK(HEAP->nan_value()->IsNumber());
|
||||
CHECK(isnan(HEAP->nan_value()->Number()));
|
||||
CHECK(heap->nan_value()->IsNumber());
|
||||
CHECK(isnan(heap->nan_value()->Number()));
|
||||
|
||||
Handle<String> s = FACTORY->NewStringFromAscii(CStrVector("fisk hest "));
|
||||
CHECK(s->IsString());
|
||||
CHECK_EQ(10, s->length());
|
||||
|
||||
String* object_symbol = String::cast(HEAP->Object_symbol());
|
||||
String* object_symbol = String::cast(heap->Object_symbol());
|
||||
CHECK(
|
||||
Isolate::Current()->context()->global_object()->HasLocalProperty(
|
||||
object_symbol));
|
||||
|
||||
// Check ToString for oddballs
|
||||
CheckOddball(HEAP->true_value(), "true");
|
||||
CheckOddball(HEAP->false_value(), "false");
|
||||
CheckOddball(HEAP->null_value(), "null");
|
||||
CheckOddball(HEAP->undefined_value(), "undefined");
|
||||
CheckOddball(isolate, heap->true_value(), "true");
|
||||
CheckOddball(isolate, heap->false_value(), "false");
|
||||
CheckOddball(isolate, heap->null_value(), "null");
|
||||
CheckOddball(isolate, heap->undefined_value(), "undefined");
|
||||
|
||||
// Check ToString for Smis
|
||||
CheckSmi(0, "0");
|
||||
CheckSmi(42, "42");
|
||||
CheckSmi(-42, "-42");
|
||||
CheckSmi(isolate, 0, "0");
|
||||
CheckSmi(isolate, 42, "42");
|
||||
CheckSmi(isolate, -42, "-42");
|
||||
|
||||
// Check ToString for Numbers
|
||||
CheckNumber(1.1, "1.1");
|
||||
CheckNumber(isolate, 1.1, "1.1");
|
||||
|
||||
CheckFindCodeObject();
|
||||
CheckFindCodeObject(isolate);
|
||||
}
|
||||
|
||||
|
||||
@ -1210,7 +1215,7 @@ TEST(TestCodeFlushingIncrementalAbort) {
|
||||
// is running so that incremental marking aborts and code flushing is
|
||||
// disabled.
|
||||
int position = 0;
|
||||
Handle<Object> breakpoint_object(Smi::FromInt(0));
|
||||
Handle<Object> breakpoint_object(Smi::FromInt(0), isolate);
|
||||
isolate->debug()->SetBreakPoint(function, breakpoint_object, &position);
|
||||
isolate->debug()->ClearAllBreakPoints();
|
||||
|
||||
@ -1357,14 +1362,16 @@ TEST(TestInternalWeakLists) {
|
||||
|
||||
// Count the number of native contexts in the weak list of native contexts
|
||||
// causing a GC after the specified number of elements.
|
||||
static int CountNativeContextsWithGC(int n) {
|
||||
static int CountNativeContextsWithGC(Isolate* isolate, int n) {
|
||||
Heap* heap = isolate->heap();
|
||||
int count = 0;
|
||||
Handle<Object> object(HEAP->native_contexts_list());
|
||||
Handle<Object> object(heap->native_contexts_list(), isolate);
|
||||
while (!object->IsUndefined()) {
|
||||
count++;
|
||||
if (count == n) HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
||||
if (count == n) heap->CollectAllGarbage(Heap::kNoGCFlags);
|
||||
object =
|
||||
Handle<Object>(Context::cast(*object)->get(Context::NEXT_CONTEXT_LINK));
|
||||
Handle<Object>(Context::cast(*object)->get(Context::NEXT_CONTEXT_LINK),
|
||||
isolate);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
@ -1377,13 +1384,16 @@ static int CountOptimizedUserFunctionsWithGC(v8::Handle<v8::Context> context,
|
||||
int n) {
|
||||
int count = 0;
|
||||
Handle<Context> icontext = v8::Utils::OpenHandle(*context);
|
||||
Handle<Object> object(icontext->get(Context::OPTIMIZED_FUNCTIONS_LIST));
|
||||
Isolate* isolate = icontext->GetIsolate();
|
||||
Handle<Object> object(icontext->get(Context::OPTIMIZED_FUNCTIONS_LIST),
|
||||
isolate);
|
||||
while (object->IsJSFunction() &&
|
||||
!Handle<JSFunction>::cast(object)->IsBuiltin()) {
|
||||
count++;
|
||||
if (count == n) HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
||||
if (count == n) isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
||||
object = Handle<Object>(
|
||||
Object::cast(JSFunction::cast(*object)->next_function_link()));
|
||||
Object::cast(JSFunction::cast(*object)->next_function_link()),
|
||||
isolate);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
@ -1391,6 +1401,7 @@ static int CountOptimizedUserFunctionsWithGC(v8::Handle<v8::Context> context,
|
||||
|
||||
TEST(TestInternalWeakListsTraverseWithGC) {
|
||||
v8::V8::Initialize();
|
||||
Isolate* isolate = Isolate::Current();
|
||||
|
||||
static const int kNumTestContexts = 10;
|
||||
|
||||
@ -1404,7 +1415,7 @@ TEST(TestInternalWeakListsTraverseWithGC) {
|
||||
for (int i = 0; i < kNumTestContexts; i++) {
|
||||
ctx[i] = v8::Context::New();
|
||||
CHECK_EQ(i + 1, CountNativeContexts());
|
||||
CHECK_EQ(i + 1, CountNativeContextsWithGC(i / 2 + 1));
|
||||
CHECK_EQ(i + 1, CountNativeContextsWithGC(isolate, i / 2 + 1));
|
||||
}
|
||||
|
||||
bool opt = (FLAG_always_opt && i::V8::UseCrankshaft());
|
||||
@ -2487,6 +2498,7 @@ TEST(ReleaseStackTraceData) {
|
||||
TEST(Regression144230) {
|
||||
InitializeVM();
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Heap* heap = isolate->heap();
|
||||
v8::HandleScope scope;
|
||||
|
||||
// First make sure that the uninitialized CallIC stub is on a single page
|
||||
@ -2494,7 +2506,7 @@ TEST(Regression144230) {
|
||||
{
|
||||
v8::HandleScope inner_scope;
|
||||
AlwaysAllocateScope always_allocate;
|
||||
SimulateFullSpace(HEAP->code_space());
|
||||
SimulateFullSpace(heap->code_space());
|
||||
isolate->stub_cache()->ComputeCallInitialize(9, RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
@ -2503,7 +2515,7 @@ TEST(Regression144230) {
|
||||
{
|
||||
v8::HandleScope inner_scope;
|
||||
AlwaysAllocateScope always_allocate;
|
||||
SimulateFullSpace(HEAP->code_space());
|
||||
SimulateFullSpace(heap->code_space());
|
||||
CompileRun("var o = { f:function(a,b,c,d,e,f,g,h,i) {}};"
|
||||
"function call() { o.f(1,2,3,4,5,6,7,8,9); };"
|
||||
"call();");
|
||||
@ -2519,7 +2531,7 @@ TEST(Regression144230) {
|
||||
" 'f' + i + '();');"
|
||||
"}");
|
||||
}
|
||||
HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
||||
heap->CollectAllGarbage(Heap::kNoGCFlags);
|
||||
|
||||
// Fourth is the tricky part. Make sure the code containing the CallIC is
|
||||
// visited first without clearing the IC. The shared function info is then
|
||||
@ -2530,12 +2542,12 @@ TEST(Regression144230) {
|
||||
JSFunction* call = JSFunction::cast(maybe_call->ToObjectChecked());
|
||||
USE(global->SetProperty(*name, Smi::FromInt(0), NONE, kNonStrictMode));
|
||||
isolate->compilation_cache()->Clear();
|
||||
call->shared()->set_ic_age(HEAP->global_ic_age() + 1);
|
||||
Handle<Object> call_code(call->code());
|
||||
Handle<Object> call_function(call);
|
||||
call->shared()->set_ic_age(heap->global_ic_age() + 1);
|
||||
Handle<Object> call_code(call->code(), isolate);
|
||||
Handle<Object> call_function(call, isolate);
|
||||
|
||||
// Now we are ready to mess up the heap.
|
||||
HEAP->CollectAllGarbage(Heap::kReduceMemoryFootprintMask);
|
||||
heap->CollectAllGarbage(Heap::kReduceMemoryFootprintMask);
|
||||
|
||||
// Either heap verification caught the problem already or we go kaboom once
|
||||
// the CallIC is executed the next time.
|
||||
|
@ -478,7 +478,7 @@ DEPENDENT_TEST(PartialDeserialization, PartialSerialization) {
|
||||
CHECK(root->IsString());
|
||||
}
|
||||
v8::HandleScope handle_scope;
|
||||
Handle<Object> root_handle(root);
|
||||
Handle<Object> root_handle(root, Isolate::Current());
|
||||
|
||||
|
||||
Object* root2;
|
||||
@ -576,7 +576,7 @@ DEPENDENT_TEST(ContextDeserialization, ContextSerialization) {
|
||||
CHECK(root->IsContext());
|
||||
}
|
||||
v8::HandleScope handle_scope;
|
||||
Handle<Object> root_handle(root);
|
||||
Handle<Object> root_handle(root, Isolate::Current());
|
||||
|
||||
|
||||
Object* root2;
|
||||
|
@ -1000,7 +1000,8 @@ TEST(CachedHashOverflow) {
|
||||
// We incorrectly allowed strings to be tagged as array indices even if their
|
||||
// values didn't fit in the hash field.
|
||||
// See http://code.google.com/p/v8/issues/detail?id=728
|
||||
ZoneScope zone(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
ZoneScope zone(isolate->runtime_zone(), DELETE_ON_EXIT);
|
||||
|
||||
InitializeVM();
|
||||
v8::HandleScope handle_scope;
|
||||
@ -1017,16 +1018,15 @@ TEST(CachedHashOverflow) {
|
||||
NULL
|
||||
};
|
||||
|
||||
Handle<Smi> fortytwo(Smi::FromInt(42));
|
||||
Handle<Smi> thirtyseven(Smi::FromInt(37));
|
||||
Handle<Object> results[] = {
|
||||
FACTORY->undefined_value(),
|
||||
fortytwo,
|
||||
FACTORY->undefined_value(),
|
||||
FACTORY->undefined_value(),
|
||||
thirtyseven,
|
||||
fortytwo,
|
||||
thirtyseven // Bug yielded 42 here.
|
||||
Handle<Smi> fortytwo(Smi::FromInt(42), isolate);
|
||||
Handle<Smi> thirtyseven(Smi::FromInt(37), isolate);
|
||||
Handle<Object> results[] = { isolate->factory()->undefined_value(),
|
||||
fortytwo,
|
||||
isolate->factory()->undefined_value(),
|
||||
isolate->factory()->undefined_value(),
|
||||
thirtyseven,
|
||||
fortytwo,
|
||||
thirtyseven // Bug yielded 42 here.
|
||||
};
|
||||
|
||||
const char* line;
|
||||
|
@ -34,6 +34,11 @@
|
||||
using namespace v8::internal;
|
||||
|
||||
|
||||
static Isolate* GetIsolateFrom(LocalContext* context) {
|
||||
return reinterpret_cast<Isolate*>((*context)->GetIsolate());
|
||||
}
|
||||
|
||||
|
||||
static Handle<JSWeakMap> AllocateJSWeakMap() {
|
||||
Handle<Map> map = FACTORY->NewMap(JS_WEAK_MAP_TYPE, JSWeakMap::kSize);
|
||||
Handle<JSObject> weakmap_obj = FACTORY->NewJSObjectFromMap(map);
|
||||
@ -71,7 +76,7 @@ TEST(Weakness) {
|
||||
LocalContext context;
|
||||
v8::HandleScope scope;
|
||||
Handle<JSWeakMap> weakmap = AllocateJSWeakMap();
|
||||
GlobalHandles* global_handles = Isolate::Current()->global_handles();
|
||||
GlobalHandles* global_handles = GetIsolateFrom(&context)->global_handles();
|
||||
|
||||
// Keep global reference to the key.
|
||||
Handle<Object> key;
|
||||
@ -88,7 +93,7 @@ TEST(Weakness) {
|
||||
v8::HandleScope scope;
|
||||
PutIntoWeakMap(weakmap,
|
||||
Handle<JSObject>(JSObject::cast(*key)),
|
||||
Handle<Smi>(Smi::FromInt(23)));
|
||||
Handle<Smi>(Smi::FromInt(23), GetIsolateFrom(&context)));
|
||||
}
|
||||
CHECK_EQ(1, ObjectHashTable::cast(weakmap->table())->NumberOfElements());
|
||||
|
||||
@ -139,7 +144,8 @@ TEST(Shrinking) {
|
||||
Handle<Map> map = FACTORY->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
|
||||
for (int i = 0; i < 32; i++) {
|
||||
Handle<JSObject> object = FACTORY->NewJSObjectFromMap(map);
|
||||
PutIntoWeakMap(weakmap, object, Handle<Smi>(Smi::FromInt(i)));
|
||||
PutIntoWeakMap(weakmap, object,
|
||||
Handle<Smi>(Smi::FromInt(i), GetIsolateFrom(&context)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,7 +224,9 @@ TEST(Regress2060b) {
|
||||
}
|
||||
Handle<JSWeakMap> weakmap = AllocateJSWeakMap();
|
||||
for (int i = 0; i < 32; i++) {
|
||||
PutIntoWeakMap(weakmap, keys[i], Handle<Smi>(Smi::FromInt(i)));
|
||||
PutIntoWeakMap(weakmap,
|
||||
keys[i],
|
||||
Handle<Smi>(Smi::FromInt(i), GetIsolateFrom(&context)));
|
||||
}
|
||||
|
||||
// Force compacting garbage collection. The subsequent collections are used
|
||||
|
Loading…
Reference in New Issue
Block a user