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,
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);
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(),
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));
}
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));
}
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);
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);
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);
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);
}
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 {
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);
}
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));
}
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));
}
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);
}
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));
}
}
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();
}
}
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);
}
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);
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);
}
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);
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);
}
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);
}
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()));
}
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 {
}
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);
}
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);
}
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);
}
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);
}
isolate->factory()->NewReferenceError(message);
error = *result;
}
- i::Handle<i::Object> result(error);
+ i::Handle<i::Object> result(error, isolate);
return Utils::ToLocal(result);
}
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);
}
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);
}
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);
}
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;
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)));
// 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));
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));
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.
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.
// 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) {
// 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));
__ 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()));
__ 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));
}
}
-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));
}
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);
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);
}
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);
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;
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));
// 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()));
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()));
}
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,
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));
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;
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;
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());
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()));
}
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;
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
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_);
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();
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"));
}
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() ||
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) {
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.
// 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);
}
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);
}
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()) {
// 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());
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());
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),
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;
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"),
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;
}
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_ };
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);
// 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.
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:
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:
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;
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);
}
-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())
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
// 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);
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 =
// 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.
// 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()) {
// 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);
}
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);
}
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()) {
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;
}
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.
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.
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.
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.
} 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;
double value = obj->Number();
result = !((value == 0) || isnan(value));
}
- return Handle<Object>(HEAP->ToBoolean(result));
+ return Handle<Object>(isolate->heap()->ToBoolean(result), isolate);
}
}
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();
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);
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()) {
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);
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();
}
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);
}
Handle<Object> Factory::ToBoolean(bool value) {
- return Handle<Object>(value
- ? isolate()->heap()->true_value()
- : isolate()->heap()->false_value());
+ return value ? true_value() : false_value();
}
Code* code,
int offset,
bool is_constructor)
- : receiver_(receiver),
+ : receiver_(receiver, function->GetIsolate()),
function_(function),
code_(code),
offset_(offset),
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);
}
HandleScope::HandleScope(Isolate* isolate) {
- ASSERT(isolate == Isolate::Current());
v8::ImplementationUtilities::HandleScopeData* current =
isolate->handle_scope_data();
isolate_ = isolate;
}
void HandleScope::CloseScope() {
- ASSERT(isolate_ == Isolate::Current());
v8::ImplementationUtilities::HandleScopeData* current =
isolate_->handle_scope_data();
current->next = prev_next_;
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;
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);
#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_) {
// 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
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;
}
-Object** HandleScope::Extend() {
- Isolate* isolate = Isolate::Current();
+Object** HandleScope::Extend(Isolate* isolate) {
v8::ImplementationUtilities::HandleScopeData* current =
isolate->handle_scope_data();
void HandleScope::DeleteExtensions(Isolate* isolate) {
- ASSERT(isolate == Isolate::Current());
v8::ImplementationUtilities::HandleScopeData* current =
isolate->handle_scope_data();
isolate->handle_scope_implementer()->DeleteExtensions(current->limit);
}
-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);
}
}
-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);
}
}
-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);
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();
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);
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();
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
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);
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,
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);
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
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
};
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
};
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");
}
+Isolate* HValue::isolate() const {
+ ASSERT(block() != NULL);
+ return block()->graph()->isolate();
+}
+
+
void HValue::AssumeRepresentation(Representation r) {
if (CheckFlag(kFlexibleRepresentation)) {
ChangeRepresentation(r);
}
-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()) {
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;
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();
}
// 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;
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_);
}
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());
}
}
#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
return IsHeapNumber() || IsString() || IsNonPrimitive();
}
- static HType TypeFromValue(Handle<Object> value);
+ static HType TypeFromValue(Isolate* isolate, Handle<Object> value);
const char* ToString();
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; }
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]);
}
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() ||
} 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_);
}
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_);
}
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);
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);
}
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);
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>();
// 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());
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()) {
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,
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,
// 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,
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(
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) {
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());
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);
}
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 =
public:
explicit HGraph(CompilationInfo* info);
- Isolate* isolate() { return isolate_; }
+ Isolate* isolate() const { return isolate_; }
Zone* zone() const { return zone_; }
CompilationInfo* info() const { return info_; }
void Assembler::Print() {
- Disassembler::Decode(stdout, buffer_, pc_);
+ Disassembler::Decode(isolate(), stdout, buffer_, pc_);
}
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),
// 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));
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));
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));
// 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());
// 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));
__ 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())));
__ 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));
}
}
return;
}
- Handle<Object> proto(holder->GetPrototype());
+ Handle<Object> proto(holder->GetPrototype(), name->GetIsolate());
if (proto->IsNull()) {
ASSERT(!lookup->IsFound());
return;
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()) {
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
}
// 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());
}
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);
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;
} 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()) {
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));
}
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 =
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);
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;
RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) {
- NoHandleAllocation nha;
+ NoHandleAllocation nha(isolate);
ASSERT(args.length() == 2);
JSArray* receiver = JSArray::cast(args[0]);
// 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
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();
// 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));
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);
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) {
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),
// 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);
// 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();
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);
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_;
// 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())
{ }
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
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);
// 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.
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");
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");
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);
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_));
} 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;
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);
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;
LChunk* LChunk::NewChunk(HGraph* graph) {
- NoHandleAllocation no_handles;
+ NoHandleAllocation no_handles(graph->isolate());
AssertNoAllocation no_gc;
int values = graph->GetMaximumValueID();
// 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;
}
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) {
}
// 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());
}
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);
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(),
}
void FunctionDone() {
- HandleScope scope(result_->GetIsolate());
+ HandleScope scope(isolate());
FunctionInfoWrapper info =
FunctionInfoWrapper::cast(
result_->GetElementNoExceptionThrown(current_parent_index_));
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
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(); }
+
+ Object* SerializeFunctionScope(Scope* scope, Zone* zone) {
+ HandleScope handle_scope(isolate());
- Handle<JSArray> scope_info_list = isolate->factory()->NewJSArray(10);
+ 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
// 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);
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();
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);
// 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();
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);
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);
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);
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;
}
}
return message;
}
+ Isolate* isolate = shared_info_array->GetIsolate();
int array_len = GetArrayLength(shared_info_array);
// Replace "blocked on active" with "replaced on active" status.
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);
}
}
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));
}
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);
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();
}
-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
Isolate* isolate,
Handle<Object> data) {
HandleScope scope(isolate);
- return GetMessage(data)->ToCString(DISALLOW_NULLS);
+ return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS);
}
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);
};
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)));
// 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));
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));
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.
// 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) {
// 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));
__ 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));
__ 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);
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",
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(
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.
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);
// 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",
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))));
}
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;
}
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(
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);
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 };
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()) {
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();
// 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...
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(
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 };
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(
// 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()) {
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()) {
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 =
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)));
}
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);
// 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",
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);
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();
}
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;
}
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);
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()));
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 =
// 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;
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);
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),
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),
HandleScope scope(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
- Handle<Object> key(args[1]);
+ Handle<Object> key(args[1], isolate);
Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table()));
table = ObjectHashSetAdd(table, key);
holder->set_table(*table);
HandleScope scope(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
- Handle<Object> key(args[1]);
+ Handle<Object> key(args[1], isolate);
Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table()));
return isolate->heap()->ToBoolean(table->Contains(*key));
}
HandleScope scope(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
- Handle<Object> key(args[1]);
+ Handle<Object> key(args[1], isolate);
Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table()));
table = ObjectHashSetRemove(table, key);
holder->set_table(*table);
CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table()));
- Handle<Object> lookup(table->Lookup(*key));
+ Handle<Object> lookup(table->Lookup(*key), isolate);
return lookup->IsTheHole() ? isolate->heap()->undefined_value() : *lookup;
}
CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table()));
- Handle<Object> lookup(table->Lookup(*key));
+ Handle<Object> lookup(table->Lookup(*key), isolate);
return isolate->heap()->ToBoolean(!lookup->IsTheHole());
}
CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table()));
- Handle<Object> lookup(table->Lookup(*key));
+ Handle<Object> lookup(table->Lookup(*key), isolate);
Handle<ObjectHashTable> new_table =
PutIntoObjectHashTable(table, key, isolate->factory()->the_hole_value());
holder->set_table(*new_table);
CONVERT_ARG_HANDLE_CHECKED(JSWeakMap, weakmap, 0);
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, key, 1);
Handle<ObjectHashTable> table(ObjectHashTable::cast(weakmap->table()));
- Handle<Object> lookup(table->Lookup(*key));
+ Handle<Object> lookup(table->Lookup(*key), isolate);
return lookup->IsTheHole() ? isolate->heap()->undefined_value() : *lookup;
}
CONVERT_ARG_HANDLE_CHECKED(JSWeakMap, weakmap, 0);
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, key, 1);
Handle<ObjectHashTable> table(ObjectHashTable::cast(weakmap->table()));
- Handle<Object> lookup(table->Lookup(*key));
+ Handle<Object> lookup(table->Lookup(*key), isolate);
return isolate->heap()->ToBoolean(!lookup->IsTheHole());
}
CONVERT_ARG_HANDLE_CHECKED(JSWeakMap, weakmap, 0);
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, key, 1);
Handle<ObjectHashTable> table(ObjectHashTable::cast(weakmap->table()));
- Handle<Object> lookup(table->Lookup(*key));
+ Handle<Object> lookup(table->Lookup(*key), isolate);
Handle<ObjectHashTable> new_table =
PutIntoObjectHashTable(table, key, isolate->factory()->the_hole_value());
weakmap->set_table(*new_table);
ASSERT(args.length() == 3);
CONVERT_ARG_HANDLE_CHECKED(JSWeakMap, weakmap, 0);
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, key, 1);
- Handle<Object> value(args[2]);
+ Handle<Object> value(args[2], isolate);
Handle<ObjectHashTable> table(ObjectHashTable::cast(weakmap->table()));
Handle<ObjectHashTable> new_table = PutIntoObjectHashTable(table, key, value);
weakmap->set_table(*new_table);
RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
Object* obj = args[0];
if (!obj->IsJSObject()) return isolate->heap()->null_value();
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPrototype) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSReceiver, input_obj, 0);
Object* obj = input_obj;
RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInPrototypeChain) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
// See ECMA-262, section 15.3.5.3, page 88 (steps 5 - 8).
Object* O = args[0];
if (raw_accessors == NULL) {
elms->set(WRITABLE_INDEX, heap->ToBoolean((attrs & READ_ONLY) == 0));
// GetProperty does access check.
- Handle<Object> value = GetProperty(obj, name);
+ Handle<Object> value = GetProperty(isolate, obj, name);
if (value.is_null()) return Failure::Exception();
elms->set(VALUE_INDEX, *value);
} else {
RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
- NoHandleAllocation nha;
+ NoHandleAllocation nha(isolate);
// args[0] == name
// args[1] == language_mode
// args[2] == value (optional)
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetName) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, f, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetName) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSFunction, f, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionNameShouldPrintAsAnonymous) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, f, 0);
return isolate->heap()->ToBoolean(
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionMarkNameShouldPrintAsAnonymous) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, f, 0);
f->shared()->set_name_should_print_as_anonymous(true);
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionRemovePrototype) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, f, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetScriptSourcePosition) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, fun, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetInstanceClassName) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSFunction, fun, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetLength) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSFunction, fun, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetPrototype) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSFunction, fun, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
RUNTIME_ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, function, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsAPIFunction) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, f, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsBuiltin) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, f, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringCharCodeAt) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(String, subject, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_CharFromCode) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
return CharFromCode(isolate, args[0]);
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringLocaleCompare) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(String, str1, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_SubString) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(String, value, 0);
isolate->heap(),
*subject,
regexp->data(),
- RegExpResultsCache::REGEXP_MULTIPLE_INDICES));
+ RegExpResultsCache::REGEXP_MULTIPLE_INDICES), isolate);
if (*cached_answer != Smi::FromInt(0)) {
Handle<FixedArray> cached_fixed_array =
Handle<FixedArray>(FixedArray::cast(*cached_answer));
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToRadixString) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_SMI_ARG_CHECKED(radix, 1);
RUNTIME_ASSERT(2 <= radix && radix <= 36);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToFixed) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_DOUBLE_ARG_CHECKED(value, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToExponential) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_DOUBLE_ARG_CHECKED(value, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToPrecision) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_DOUBLE_ARG_CHECKED(value, 0);
if (index < static_cast<uint32_t>(string->length())) {
string->TryFlatten();
return LookupSingleCharacterStringFromCode(
+ string->GetIsolate(),
string->Get(index));
}
return Execution::CharAt(string, index);
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetProperty) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
Handle<Object> object = args.at<Object>(0);
// KeyedStringGetProperty is called from KeyedLoadIC::GenerateGeneric.
RUNTIME_FUNCTION(MaybeObject*, Runtime_KeyedGetProperty) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
// Fast cases for getting named properties of the receiver JSObject
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetProperty) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
RUNTIME_ASSERT(args.length() == 4 || args.length() == 5);
Handle<Object> object = args.at<Object>(0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_TransitionElementsSmiToDouble) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
RUNTIME_ASSERT(args.length() == 1);
Handle<Object> object = args.at<Object>(0);
if (object->IsJSObject()) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_TransitionElementsDoubleToObject) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
RUNTIME_ASSERT(args.length() == 1);
Handle<Object> object = args.at<Object>(0);
if (object->IsJSObject()) {
// This is used to decide if we should transform null and undefined
// into the global object when doing call and apply.
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetNativeFlag) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
RUNTIME_ASSERT(args.length() == 1);
Handle<Object> object = args.at<Object>(0);
// Set a local property, even if it is READ_ONLY. If the property does not
// exist, it will be added with attributes NONE.
RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
RUNTIME_ASSERT(args.length() == 3 || args.length() == 4);
CONVERT_ARG_CHECKED(JSObject, object, 0);
CONVERT_ARG_CHECKED(String, name, 1);
RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteProperty) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(JSReceiver, object, 0);
// Handle hidden prototypes. If there's a hidden prototype above this thing
// then we have to check it for properties, because they are supposed to
// look like they are on this object.
- Handle<Object> proto(object->GetPrototype());
+ Handle<Object> proto(object->GetPrototype(), isolate);
if (proto->IsJSObject() &&
Handle<JSObject>::cast(proto)->map()->is_hidden_prototype()) {
return HasLocalPropertyImplementation(isolate,
RUNTIME_FUNCTION(MaybeObject*, Runtime_HasLocalProperty) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(String, key, 1);
RUNTIME_FUNCTION(MaybeObject*, Runtime_HasProperty) {
- NoHandleAllocation na;
+ NoHandleAllocation na(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSReceiver, receiver, 0);
CONVERT_ARG_CHECKED(String, key, 1);
RUNTIME_FUNCTION(MaybeObject*, Runtime_HasElement) {
- NoHandleAllocation na;
+ NoHandleAllocation na(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSReceiver, receiver, 0);
CONVERT_SMI_ARG_CHECKED(index, 1);
RUNTIME_FUNCTION(MaybeObject*, Runtime_IsPropertyEnumerable) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSObject, object, 0);
return *isolate->factory()->NewJSArray(0);
}
- Handle<Object> proto(object->GetPrototype());
+ Handle<Object> proto(object->GetPrototype(), isolate);
// If proxy is detached we simply return an empty array.
if (proto->IsNull()) return *isolate->factory()->NewJSArray(0);
object = Handle<JSObject>::cast(proto);
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetArgumentsProperty) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
// Compute the frame holding the arguments.
RUNTIME_FUNCTION(MaybeObject*, Runtime_ToBool) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
return args[0]->ToBoolean();
// Returns the type string of a value; see ECMA-262, 11.4.3 (p 47).
// Possible optimizations: put the type string into the oddballs.
RUNTIME_FUNCTION(MaybeObject*, Runtime_Typeof) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
Object* obj = args[0];
if (obj->IsNumber()) return isolate->heap()->number_symbol();
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToNumber) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(String, subject, 0);
subject->TryFlatten();
RUNTIME_FUNCTION(MaybeObject*, Runtime_QuoteJSONString) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
CONVERT_ARG_CHECKED(String, str, 0);
if (!str->IsFlat()) {
MaybeObject* try_flatten = str->TryFlatten();
RUNTIME_FUNCTION(MaybeObject*, Runtime_QuoteJSONStringComma) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
CONVERT_ARG_CHECKED(String, str, 0);
if (!str->IsFlat()) {
MaybeObject* try_flatten = str->TryFlatten();
RUNTIME_FUNCTION(MaybeObject*, Runtime_QuoteJSONStringArray) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSArray, array, 0);
ASSERT(args.length() == 1);
HandleScope scope(isolate);
BasicJsonStringifier stringifier(isolate);
- return stringifier.Stringify(Handle<Object>(args[0]));
+ return stringifier.Stringify(Handle<Object>(args[0], isolate));
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringParseInt) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
CONVERT_ARG_CHECKED(String, s, 0);
CONVERT_SMI_ARG_CHECKED(radix, 1);
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringParseFloat) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
CONVERT_ARG_CHECKED(String, str, 0);
// ECMA-262 section 15.1.2.3, empty string is NaN
Arguments args,
Isolate* isolate,
unibrow::Mapping<typename ConvertTraits::UnibrowConverter, 128>* mapping) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
CONVERT_ARG_CHECKED(String, s, 0);
s = s->TryFlattenGetString();
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringTrim) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(String, s, 0);
RUNTIME_ASSERT(pattern_length > 0);
if (limit == 0xffffffffu) {
- Handle<Object> cached_answer(RegExpResultsCache::Lookup(
- isolate->heap(),
- *subject,
- *pattern,
- RegExpResultsCache::STRING_SPLIT_SUBSTRINGS));
+ Handle<Object> cached_answer(
+ RegExpResultsCache::Lookup(isolate->heap(),
+ *subject,
+ *pattern,
+ RegExpResultsCache::STRING_SPLIT_SUBSTRINGS),
+ isolate);
if (*cached_answer != Smi::FromInt(0)) {
// The cache FixedArray is a COW-array and can therefore be reused.
Handle<JSArray> result =
elements = isolate->factory()->NewFixedArray(length);
}
for (int i = position; i < length; ++i) {
- Handle<Object> str = LookupSingleCharacterStringFromCode(s->Get(i));
+ Handle<Object> str =
+ LookupSingleCharacterStringFromCode(isolate, s->Get(i));
elements->set(i, *str);
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_NewStringWrapper) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(String, value, 0);
return value->ToObject();
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToString) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
Object* number = args[0];
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToStringSkipCache) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
Object* number = args[0];
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToInteger) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_DOUBLE_ARG_CHECKED(number, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToIntegerMapMinusZero) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_DOUBLE_ARG_CHECKED(number, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToJSUint32) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_NUMBER_CHECKED(int32_t, number, Uint32, args[0]);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToJSInt32) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_DOUBLE_ARG_CHECKED(number, 0);
// Converts a Number to a Smi, if possible. Returns NaN if the number is not
// a small integer.
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToSmi) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
Object* obj = args[0];
RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateHeapNumber) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 0);
return isolate->heap()->AllocateHeapNumber(0);
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberAdd) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_DOUBLE_ARG_CHECKED(x, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberSub) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_DOUBLE_ARG_CHECKED(x, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberMul) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_DOUBLE_ARG_CHECKED(x, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberUnaryMinus) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_DOUBLE_ARG_CHECKED(x, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberAlloc) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 0);
return isolate->heap()->NumberFromDouble(9876543210.0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberDiv) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_DOUBLE_ARG_CHECKED(x, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberMod) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_DOUBLE_ARG_CHECKED(x, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringAdd) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(String, str1, 0);
CONVERT_ARG_CHECKED(String, str2, 1);
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringBuilderConcat) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(JSArray, array, 0);
if (!args[1]->IsSmi()) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringBuilderJoin) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(JSArray, array, 0);
if (!args[1]->IsSmi()) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_SparseJoinWithSeparator) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(JSArray, elements_array, 0);
RUNTIME_ASSERT(elements_array->HasFastSmiOrObjectElements());
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberOr) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_NUMBER_CHECKED(int32_t, x, Int32, args[0]);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberAnd) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_NUMBER_CHECKED(int32_t, x, Int32, args[0]);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberXor) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_NUMBER_CHECKED(int32_t, x, Int32, args[0]);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberNot) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_NUMBER_CHECKED(int32_t, x, Int32, args[0]);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberShl) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_NUMBER_CHECKED(int32_t, x, Int32, args[0]);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberShr) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_NUMBER_CHECKED(uint32_t, x, Uint32, args[0]);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberSar) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_NUMBER_CHECKED(int32_t, x, Int32, args[0]);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberEquals) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_DOUBLE_ARG_CHECKED(x, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringEquals) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(String, x, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberCompare) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 3);
CONVERT_DOUBLE_ARG_CHECKED(x, 0);
// Compare two Smis as if they were converted to strings and then
// compared lexicographically.
RUNTIME_FUNCTION(MaybeObject*, Runtime_SmiLexicographicCompare) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_SMI_ARG_CHECKED(x_value, 0);
CONVERT_SMI_ARG_CHECKED(y_value, 1);
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringCompare) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(String, x, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_acos) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_acos()->Increment();
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_asin) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_asin()->Increment();
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_atan) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_atan()->Increment();
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_atan2) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
isolate->counters()->math_atan2()->Increment();
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_ceil) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_ceil()->Increment();
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_cos) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_cos()->Increment();
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_exp) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_exp()->Increment();
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_floor) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_floor()->Increment();
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_log) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_log()->Increment();
// Slow version of Math.pow. We check for fast paths for special cases.
// Used if SSE2/VFP3 is not available.
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_pow) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
isolate->counters()->math_pow()->Increment();
// Fast version of Math.pow if we know that y is not an integer and y is not
// -0.5 or 0.5. Used as slow case from full codegen.
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_pow_cfunction) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
isolate->counters()->math_pow()->Increment();
RUNTIME_FUNCTION(MaybeObject*, Runtime_RoundNumber) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_round()->Increment();
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_sin) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_sin()->Increment();
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_sqrt) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_sqrt()->Increment();
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_tan) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_tan()->Increment();
RUNTIME_FUNCTION(MaybeObject*, Runtime_DateMakeDay) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_SMI_ARG_CHECKED(year, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NewStrictArgumentsFast) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 3);
JSFunction* callee = JSFunction::cast(args[0]);
SmartArrayPointer<Handle<Object> > param_data(
NewArray<Handle<Object> >(*total_argc));
for (int i = 0; i < args_count; i++) {
- Handle<Object> val = args_slots[i].GetValue();
+ Handle<Object> val = args_slots[i].GetValue(isolate);
param_data[prefix_argc + i] = val;
}
SmartArrayPointer<Handle<Object> > param_data(
NewArray<Handle<Object> >(*total_argc));
for (int i = 0; i < args_count; i++) {
- Handle<Object> val = Handle<Object>(frame->GetParameter(i));
+ Handle<Object> val = Handle<Object>(frame->GetParameter(i), isolate);
param_data[prefix_argc + i] = val;
}
return param_data;
JSFunction::cast(*bindee)->function_bindings());
new_bindings =
isolate->factory()->NewFixedArray(old_bindings->length() + argc);
- bindee = Handle<Object>(old_bindings->get(JSFunction::kBoundFunctionIndex));
+ bindee = Handle<Object>(old_bindings->get(JSFunction::kBoundFunctionIndex),
+ isolate);
i = 0;
for (int n = old_bindings->length(); i < n; i++) {
new_bindings->set(i, old_bindings->get(i));
Handle<FixedArray>(FixedArray::cast(function->function_bindings()));
int bound_argc = bound_args->length() - JSFunction::kBoundArgumentsStartIndex;
Handle<Object> bound_function(
- JSReceiver::cast(bound_args->get(JSFunction::kBoundFunctionIndex)));
+ JSReceiver::cast(bound_args->get(JSFunction::kBoundFunctionIndex)),
+ isolate);
ASSERT(!bound_function->IsJSFunction() ||
!Handle<JSFunction>::cast(bound_function)->shared()->bound());
GetCallerArguments(isolate, bound_argc, &total_argc);
for (int i = 0; i < bound_argc; i++) {
param_data[i] = Handle<Object>(bound_args->get(
- JSFunction::kBoundArgumentsStartIndex + i));
+ JSFunction::kBoundArgumentsStartIndex + i), isolate);
}
if (!bound_function->IsJSFunction()) {
MaybeObject* maybe = args[1 + i];
Object* object;
if (!maybe->To<Object>(&object)) return maybe;
- argv[i] = Handle<Object>(object);
+ argv[i] = Handle<Object>(object, isolate);
}
bool threw;
Handle<JSReceiver> hfun(fun);
- Handle<Object> hreceiver(receiver);
+ Handle<Object> hreceiver(receiver, isolate);
Handle<Object> result =
Execution::Call(hfun, hreceiver, argc, argv, &threw, true);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NewGlobalContext) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_CHECKED(JSFunction, function, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_NewFunctionContext) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, function, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_PushWithContext) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
JSObject* extension_object;
if (args[0]->IsJSObject()) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_PushCatchContext) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 3);
String* name = String::cast(args[0]);
Object* thrown_object = args[1];
RUNTIME_FUNCTION(MaybeObject*, Runtime_PushBlockContext) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 2);
ScopeInfo* scope_info = ScopeInfo::cast(args[0]);
JSFunction* function;
Handle<JSObject> object = Handle<JSObject>::cast(holder);
ASSERT(object->HasProperty(*name));
// GetProperty below can cause GC.
- Handle<Object> receiver_handle(object->IsGlobalObject()
- ? GlobalObject::cast(*object)->global_receiver()
- : ComputeReceiverForNonGlobal(isolate, *object));
+ Handle<Object> receiver_handle(
+ object->IsGlobalObject()
+ ? GlobalObject::cast(*object)->global_receiver()
+ : ComputeReceiverForNonGlobal(isolate, *object),
+ isolate);
// No need to unhole the value here. This is taken care of by the
// GetProperty function.
// First check if this is a real stack overflow.
if (isolate->stack_guard()->IsStackOverflow()) {
- NoHandleAllocation na;
+ NoHandleAllocation na(isolate);
return isolate->StackOverflow();
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_TraceEnter) {
ASSERT(args.length() == 0);
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
PrintTransition(isolate, NULL);
return isolate->heap()->undefined_value();
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_TraceExit) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
PrintTransition(isolate, args[0]);
return args[0]; // return TOS
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPrint) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
#ifdef DEBUG
RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugTrace) {
ASSERT(args.length() == 0);
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
isolate->PrintStack();
return isolate->heap()->undefined_value();
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_DateCurrentTime) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 0);
// According to ECMA-262, section 15.9.1, page 117, the precision of
RUNTIME_FUNCTION(MaybeObject*, Runtime_DateLocalTimezone) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_DOUBLE_ARG_CHECKED(x, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_DateToUTC) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_DOUBLE_ARG_CHECKED(x, 0);
uint32_t current_length = static_cast<uint32_t>(current_storage->length());
for (uint32_t i = 0; i < current_length; i++) {
HandleScope loop_scope(isolate_);
- Handle<Object> element(current_storage->get(i));
+ Handle<Object> element(current_storage->get(i), isolate_);
if (!element->IsTheHole()) {
Handle<SeededNumberDictionary> new_storage =
isolate_->factory()->DictionaryAtNumberPut(slow_storage, i, element);
SeededNumberDictionary::cast(array->elements()));
int capacity = dictionary->Capacity();
for (int i = 0; i < capacity; i++) {
- Handle<Object> key(dictionary->KeyAt(i));
+ Handle<Object> key(dictionary->KeyAt(i), array->GetIsolate());
if (dictionary->IsKey(*key)) {
element_count++;
}
if (elements_are_guaranteed_smis) {
for (uint32_t j = 0; j < len; j++) {
HandleScope loop_scope(isolate);
- Handle<Smi> e(Smi::FromInt(static_cast<int>(array->get_scalar(j))));
+ Handle<Smi> e(Smi::FromInt(static_cast<int>(array->get_scalar(j))),
+ isolate);
visitor->visit(j, e);
}
} else {
HandleScope loop_scope(isolate);
int64_t val = static_cast<int64_t>(array->get_scalar(j));
if (Smi::IsValid(static_cast<intptr_t>(val))) {
- Handle<Smi> e(Smi::FromInt(static_cast<int>(val)));
+ Handle<Smi> e(Smi::FromInt(static_cast<int>(val)), isolate);
visitor->visit(j, e);
} else {
Handle<Object> e =
static void CollectElementIndices(Handle<JSObject> object,
uint32_t range,
List<uint32_t>* indices) {
+ Isolate* isolate = object->GetIsolate();
ElementsKind kind = object->GetElementsKind();
switch (kind) {
case FAST_SMI_ELEMENTS:
SeededNumberDictionary::cast(object->elements()));
uint32_t capacity = dict->Capacity();
for (uint32_t j = 0; j < capacity; j++) {
- HandleScope loop_scope(object->GetIsolate());
- Handle<Object> k(dict->KeyAt(j));
+ HandleScope loop_scope(isolate);
+ Handle<Object> k(dict->KeyAt(j), isolate);
if (dict->IsKey(*k)) {
ASSERT(k->IsNumber());
uint32_t index = static_cast<uint32_t>(k->Number());
}
}
- Handle<Object> prototype(object->GetPrototype());
+ Handle<Object> prototype(object->GetPrototype(), isolate);
if (prototype->IsJSObject()) {
// The prototype will usually have no inherited element indices,
// but we have to check.
Handle<ExternalPixelArray> pixels(ExternalPixelArray::cast(
receiver->elements()));
for (uint32_t j = 0; j < length; j++) {
- Handle<Smi> e(Smi::FromInt(pixels->get_scalar(j)));
+ Handle<Smi> e(Smi::FromInt(pixels->get_scalar(j)), isolate);
visitor->visit(j, e);
}
break;
uint32_t estimate_nof_elements = 0;
for (int i = 0; i < argument_count; i++) {
HandleScope loop_scope(isolate);
- Handle<Object> obj(elements->get(i));
+ Handle<Object> obj(elements->get(i), isolate);
uint32_t length_estimate;
uint32_t element_estimate;
if (obj->IsJSArray()) {
int j = 0;
bool failure = false;
for (int i = 0; i < argument_count; i++) {
- Handle<Object> obj(elements->get(i));
+ Handle<Object> obj(elements->get(i), isolate);
if (obj->IsSmi()) {
double_storage->set(j, Smi::cast(*obj)->value());
j++;
ArrayConcatVisitor visitor(isolate, storage, fast_case);
for (int i = 0; i < argument_count; i++) {
- Handle<Object> obj(elements->get(i));
+ Handle<Object> obj(elements->get(i), isolate);
if (obj->IsJSArray()) {
Handle<JSArray> array = Handle<JSArray>::cast(obj);
if (!IterateElements(isolate, array, &visitor)) {
// This will not allocate (flatten the string), but it may run
// very slowly for very deeply nested ConsStrings. For debugging use only.
RUNTIME_FUNCTION(MaybeObject*, Runtime_GlobalPrint) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(String, string, 0);
// First fill all parameters.
for (int i = 0; i < scope_info->ParameterCount(); ++i) {
- Handle<Object> value(
- i < frame_inspector->GetParametersCount() ?
- frame_inspector->GetParameter(i) : isolate->heap()->undefined_value());
+ Handle<Object> value(i < frame_inspector->GetParametersCount()
+ ? frame_inspector->GetParameter(i)
+ : isolate->heap()->undefined_value(),
+ isolate);
RETURN_IF_EMPTY_HANDLE_VALUE(
isolate,
SetProperty(isolate,
local_scope,
Handle<String>(scope_info->StackLocalName(i)),
- Handle<Object>(frame_inspector->GetExpression(i)),
+ Handle<Object>(frame_inspector->GetExpression(i), isolate),
NONE,
kNonStrictMode),
Handle<JSObject>());
SetProperty(isolate,
local_scope,
key,
- GetProperty(ext, key),
+ GetProperty(isolate, ext, key),
NONE,
kNonStrictMode),
Handle<JSObject>());
SetProperty(isolate,
closure_scope,
key,
- GetProperty(ext, key),
+ GetProperty(isolate, ext, key),
NONE,
kNonStrictMode),
Handle<JSObject>());
Handle<Context> context) {
ASSERT(context->IsCatchContext());
Handle<String> name(String::cast(context->extension()));
- Handle<Object> thrown_object(context->get(Context::THROWN_OBJECT_INDEX));
+ Handle<Object> thrown_object(context->get(Context::THROWN_OBJECT_INDEX),
+ isolate);
Handle<JSObject> catch_scope =
isolate->factory()->NewJSObject(isolate->object_function());
RETURN_IF_EMPTY_HANDLE_VALUE(
if (!CurrentContext().is_null()) {
CurrentContext()->Print();
if (CurrentContext()->has_extension()) {
- Handle<Object> extension(CurrentContext()->extension());
+ Handle<Object> extension(CurrentContext()->extension(), isolate_);
if (extension->IsJSContextExtensionObject()) {
extension->Print();
}
PrintF("Closure:\n");
CurrentContext()->Print();
if (CurrentContext()->has_extension()) {
- Handle<Object> extension(CurrentContext()->extension());
+ Handle<Object> extension(CurrentContext()->extension(), isolate_);
if (extension->IsJSContextExtensionObject()) {
extension->Print();
}
if (scope_info->Type() == CATCH_SCOPE) {
Handle<String> name(String::cast(current->extension()));
- Handle<Object> thrown_object(current->get(Context::THROWN_OBJECT_INDEX));
+ Handle<Object> thrown_object(current->get(Context::THROWN_OBJECT_INDEX),
+ isolate);
context =
isolate->factory()->NewCatchContext(function,
context,
CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]);
CONVERT_ARG_HANDLE_CHECKED(String, source, 3);
CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 4);
- Handle<Object> additional_context(args[5]);
+ Handle<Object> additional_context(args[5], isolate);
// Handle the processing of break.
DisableBreak disable_break_save(disable_break);
}
CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 2);
- Handle<Object> additional_context(args[3]);
+ Handle<Object> additional_context(args[3], isolate);
// Handle the processing of break.
DisableBreak disable_break_save(disable_break);
Object* instance_filter, int max_references,
FixedArray* instances, int instances_size,
JSFunction* arguments_function) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(target->GetIsolate());
AssertNoAllocation no_alloc;
// Iterate the heap.
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetInferredName) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, f, 0);
RUNTIME_FUNCTION(MaybeObject*, Runtime_ProfilerResume) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
v8::V8::ResumeProfiler();
return isolate->heap()->undefined_value();
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_ProfilerPause) {
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
v8::V8::PauseProfiler();
return isolate->heap()->undefined_value();
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetV8Version) {
ASSERT_EQ(args.length(), 0);
- NoHandleAllocation ha;
+ NoHandleAllocation ha(isolate);
const char* version_string = v8::V8::GetVersion();
HandleScope scope(isolate);
Handle<JSFunctionResultCache> cache_handle(cache);
- Handle<Object> key_handle(key);
+ Handle<Object> key_handle(key, isolate);
Handle<Object> value;
{
Handle<JSFunction> factory(JSFunction::cast(
cache_handle->get(JSFunctionResultCache::kFactoryIndex)));
// TODO(antonm): consider passing a receiver when constructing a cache.
- Handle<Object> receiver(isolate->native_context()->global_object());
+ Handle<Object> receiver(isolate->native_context()->global_object(),
+ isolate);
// This handle is nor shared, nor used later, so it's safe.
Handle<Object> argv[] = { key_handle };
bool pending_exception;
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");
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;
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),
// 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));
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));
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());
// 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));
__ 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
__ 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);
}
}
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(
" obj.many;"
"}");
}
- int count_after = i::HandleScope::NumberOfHandles();
+ int count_after = i::HandleScope::NumberOfHandles(isolate);
CHECK_EQ(count_before, count_after);
}
"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);
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();
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));
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();
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));
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();
} 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));
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();
// 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;
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();
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);
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();
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);
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();
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);
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();
// 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);
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();
// 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);
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();
// 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);
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();
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)));
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();
// 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;
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();
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));
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();
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));
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();
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));
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();
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);
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,
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);
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,
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);
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));
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
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.
__ 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();
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));
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();
// 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);
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);
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());
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));
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));
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));
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;
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;
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;
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;
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;
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;
Object* code = HEAP->CreateCode(
desc,
Code::ComputeFlags(Code::STUB),
- Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
+ Handle<Code>())->ToObjectChecked();
CHECK(code->IsCode());
}
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.
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;
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;
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());
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());
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);
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());
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);
}
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());
}
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;
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[] =
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();
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:
// 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;
}
// 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));
}
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();
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();
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);
}
}
-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);
}
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());
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);
}
// 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();
// 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;
}
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;
}
TEST(TestInternalWeakListsTraverseWithGC) {
v8::V8::Initialize();
+ Isolate* isolate = Isolate::Current();
static const int kNumTestContexts = 10;
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());
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
{
v8::HandleScope inner_scope;
AlwaysAllocateScope always_allocate;
- SimulateFullSpace(HEAP->code_space());
+ SimulateFullSpace(heap->code_space());
isolate->stub_cache()->ComputeCallInitialize(9, RelocInfo::CODE_TARGET);
}
{
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();");
" '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
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.
CHECK(root->IsString());
}
v8::HandleScope handle_scope;
- Handle<Object> root_handle(root);
+ Handle<Object> root_handle(root, Isolate::Current());
Object* root2;
CHECK(root->IsContext());
}
v8::HandleScope handle_scope;
- Handle<Object> root_handle(root);
+ Handle<Object> root_handle(root, Isolate::Current());
Object* root2;
// 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;
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;
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);
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;
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());
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)));
}
}
}
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