| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index bc2681bc87717e406d5d54beaadfe244e5d04c23..68b36a78f50b40637e258b708e605ff58213b438 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -3557,7 +3557,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringMatch) {
|
| CONVERT_ARG_HANDLE_CHECKED(String, subject, 0);
|
| CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 1);
|
| CONVERT_ARG_HANDLE_CHECKED(JSArray, regexp_info, 2);
|
| - HandleScope handles;
|
| + HandleScope handles(isolate);
|
|
|
| RegExpImpl::GlobalCache global_cache(regexp, subject, true, isolate);
|
| if (global_cache.HasException()) return Failure::Exception();
|
| @@ -4455,7 +4455,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) {
|
| Handle<Object> value = args.at<Object>(2);
|
| CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 3);
|
| CONVERT_SMI_ARG_CHECKED(literal_index, 4);
|
| - HandleScope scope;
|
| + HandleScope scope(isolate);
|
|
|
| Object* raw_boilerplate_object = literals->get(literal_index);
|
| Handle<JSArray> boilerplate_object(JSArray::cast(raw_boilerplate_object));
|
| @@ -6156,7 +6156,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringSplit) {
|
| Handle<FixedArray> elements(FixedArray::cast(result->elements()));
|
| int part_start = 0;
|
| for (int i = 0; i < part_count; i++) {
|
| - HandleScope local_loop_handle;
|
| + HandleScope local_loop_handle(isolate);
|
| int part_end = indices.at(i);
|
| Handle<String> substring =
|
| isolate->factory()->NewProperSubString(subject, part_start, part_end);
|
| @@ -7569,10 +7569,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewClosure) {
|
| // into C++ code. Collect these in a newly allocated array of handles (possibly
|
| // prefixed by a number of empty handles).
|
| static SmartArrayPointer<Handle<Object> > GetCallerArguments(
|
| + Isolate* isolate,
|
| int prefix_argc,
|
| int* total_argc) {
|
| // Find frame containing arguments passed to the caller.
|
| - JavaScriptFrameIterator it;
|
| + JavaScriptFrameIterator it(isolate);
|
| JavaScriptFrame* frame = it.frame();
|
| List<JSFunction*> functions(2);
|
| frame->GetFunctions(&functions);
|
| @@ -7626,7 +7627,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionBindArguments) {
|
| bound_function->shared()->set_bound(true);
|
| // Get all arguments of calling function (Function.prototype.bind).
|
| int argc = 0;
|
| - SmartArrayPointer<Handle<Object> > arguments = GetCallerArguments(0, &argc);
|
| + SmartArrayPointer<Handle<Object> > arguments =
|
| + GetCallerArguments(isolate, 0, &argc);
|
| // Don't count the this-arg.
|
| if (argc > 0) {
|
| ASSERT(*arguments[0] == args[2]);
|
| @@ -7708,7 +7710,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObjectFromBound) {
|
|
|
| int total_argc = 0;
|
| SmartArrayPointer<Handle<Object> > param_data =
|
| - GetCallerArguments(bound_argc, &total_argc);
|
| + 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));
|
| @@ -8915,17 +8917,17 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Interrupt) {
|
| }
|
|
|
|
|
| -static int StackSize() {
|
| +static int StackSize(Isolate* isolate) {
|
| int n = 0;
|
| - for (JavaScriptFrameIterator it; !it.done(); it.Advance()) n++;
|
| + for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) n++;
|
| return n;
|
| }
|
|
|
|
|
| -static void PrintTransition(Object* result) {
|
| +static void PrintTransition(Isolate* isolate, Object* result) {
|
| // indentation
|
| { const int nmax = 80;
|
| - int n = StackSize();
|
| + int n = StackSize(isolate);
|
| if (n <= nmax)
|
| PrintF("%4d:%*s", n, n, "");
|
| else
|
| @@ -8933,7 +8935,7 @@ static void PrintTransition(Object* result) {
|
| }
|
|
|
| if (result == NULL) {
|
| - JavaScriptFrame::PrintTop(stdout, true, false);
|
| + JavaScriptFrame::PrintTop(isolate, stdout, true, false);
|
| PrintF(" {\n");
|
| } else {
|
| // function result
|
| @@ -8947,14 +8949,14 @@ static void PrintTransition(Object* result) {
|
| RUNTIME_FUNCTION(MaybeObject*, Runtime_TraceEnter) {
|
| ASSERT(args.length() == 0);
|
| NoHandleAllocation ha;
|
| - PrintTransition(NULL);
|
| + PrintTransition(isolate, NULL);
|
| return isolate->heap()->undefined_value();
|
| }
|
|
|
|
|
| RUNTIME_FUNCTION(MaybeObject*, Runtime_TraceExit) {
|
| NoHandleAllocation ha;
|
| - PrintTransition(args[0]);
|
| + PrintTransition(isolate, args[0]);
|
| return args[0]; // return TOS
|
| }
|
|
|
| @@ -9366,7 +9368,7 @@ class ArrayConcatVisitor {
|
| current_storage->length()));
|
| uint32_t current_length = static_cast<uint32_t>(current_storage->length());
|
| for (uint32_t i = 0; i < current_length; i++) {
|
| - HandleScope loop_scope;
|
| + HandleScope loop_scope(isolate_);
|
| Handle<Object> element(current_storage->get(i));
|
| if (!element->IsTheHole()) {
|
| Handle<SeededNumberDictionary> new_storage =
|
| @@ -9481,13 +9483,13 @@ static void IterateExternalArrayElements(Isolate* isolate,
|
| if (elements_are_ints) {
|
| if (elements_are_guaranteed_smis) {
|
| for (uint32_t j = 0; j < len; j++) {
|
| - HandleScope loop_scope;
|
| + HandleScope loop_scope(isolate);
|
| Handle<Smi> e(Smi::FromInt(static_cast<int>(array->get_scalar(j))));
|
| visitor->visit(j, e);
|
| }
|
| } else {
|
| for (uint32_t j = 0; j < len; j++) {
|
| - HandleScope loop_scope;
|
| + 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)));
|
| @@ -9547,7 +9549,7 @@ static void CollectElementIndices(Handle<JSObject> object,
|
| SeededNumberDictionary::cast(object->elements()));
|
| uint32_t capacity = dict->Capacity();
|
| for (uint32_t j = 0; j < capacity; j++) {
|
| - HandleScope loop_scope;
|
| + HandleScope loop_scope(object->GetIsolate());
|
| Handle<Object> k(dict->KeyAt(j));
|
| if (dict->IsKey(*k)) {
|
| ASSERT(k->IsNumber());
|
| @@ -9710,7 +9712,7 @@ static bool IterateElements(Isolate* isolate,
|
| int j = 0;
|
| int n = indices.length();
|
| while (j < n) {
|
| - HandleScope loop_scope;
|
| + HandleScope loop_scope(isolate);
|
| uint32_t index = indices[j];
|
| Handle<Object> element = Object::GetElement(receiver, index);
|
| RETURN_IF_EMPTY_HANDLE_VALUE(isolate, element, false);
|
| @@ -9805,7 +9807,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayConcat) {
|
| uint32_t estimate_result_length = 0;
|
| uint32_t estimate_nof_elements = 0;
|
| for (int i = 0; i < argument_count; i++) {
|
| - HandleScope loop_scope;
|
| + HandleScope loop_scope(isolate);
|
| Handle<Object> obj(elements->get(i));
|
| uint32_t length_estimate;
|
| uint32_t element_estimate;
|
| @@ -11688,7 +11690,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPrintScopes) {
|
|
|
| #ifdef DEBUG
|
| // Print the scopes for the top frame.
|
| - StackFrameLocator locator;
|
| + StackFrameLocator locator(isolate);
|
| JavaScriptFrame* frame = locator.FindJavaScriptFrame(0);
|
| for (ScopeIterator it(isolate, frame, 0);
|
| !it.Done();
|
| @@ -13275,7 +13277,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_MessageGetScript) {
|
| // Exclude the code in release mode.
|
| RUNTIME_FUNCTION(MaybeObject*, Runtime_ListNatives) {
|
| ASSERT(args.length() == 0);
|
| - HandleScope scope;
|
| + HandleScope scope(isolate);
|
| #define COUNT_ENTRY(Name, argc, ressize) + 1
|
| int entry_count = 0
|
| RUNTIME_FUNCTION_LIST(COUNT_ENTRY)
|
| @@ -13288,7 +13290,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ListNatives) {
|
| bool inline_runtime_functions = false;
|
| #define ADD_ENTRY(Name, argc, ressize) \
|
| { \
|
| - HandleScope inner; \
|
| + HandleScope inner(isolate); \
|
| Handle<String> name; \
|
| /* Inline runtime functions have an underscore in front of the name. */ \
|
| if (inline_runtime_functions) { \
|
| @@ -13324,7 +13326,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Log) {
|
| String::FlatContent format_content = format->GetFlatContent();
|
| RUNTIME_ASSERT(format_content.IsAscii());
|
| Vector<const uint8_t> chars = format_content.ToOneByteVector();
|
| - LOGGER->LogRuntime(Vector<const char>::cast(chars), elms);
|
| + LOGGER->LogRuntime(isolate, Vector<const char>::cast(chars), elms);
|
| return isolate->heap()->undefined_value();
|
| }
|
|
|
|
|