OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 case CompileTimeValue::ARRAY_LITERAL: | 461 case CompileTimeValue::ARRAY_LITERAL: |
462 return Runtime::CreateArrayLiteralBoilerplate( | 462 return Runtime::CreateArrayLiteralBoilerplate( |
463 isolate, literals, elements); | 463 isolate, literals, elements); |
464 default: | 464 default: |
465 UNREACHABLE(); | 465 UNREACHABLE(); |
466 return Handle<Object>::null(); | 466 return Handle<Object>::null(); |
467 } | 467 } |
468 } | 468 } |
469 | 469 |
470 | 470 |
471 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteral) { | 471 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CreateObjectLiteral) { |
472 HandleScope scope(isolate); | 472 HandleScope scope(isolate); |
473 ASSERT(args.length() == 4); | 473 ASSERT(args.length() == 4); |
474 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 474 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
475 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 475 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
476 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); | 476 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); |
477 CONVERT_SMI_ARG_CHECKED(flags, 3); | 477 CONVERT_SMI_ARG_CHECKED(flags, 3); |
478 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; | 478 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; |
479 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; | 479 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; |
480 | 480 |
481 // Check if boilerplate exists. If not, create it first. | 481 // Check if boilerplate exists. If not, create it first. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 ? JSObject::kNoHints | 563 ? JSObject::kNoHints |
564 : JSObject::kObjectIsShallowArray; | 564 : JSObject::kObjectIsShallowArray; |
565 Handle<JSObject> copy = JSObject::DeepCopy(boilerplate, &usage_context, | 565 Handle<JSObject> copy = JSObject::DeepCopy(boilerplate, &usage_context, |
566 hints); | 566 hints); |
567 usage_context.ExitScope(site, boilerplate); | 567 usage_context.ExitScope(site, boilerplate); |
568 RETURN_IF_EMPTY_HANDLE(isolate, copy); | 568 RETURN_IF_EMPTY_HANDLE(isolate, copy); |
569 return *copy; | 569 return *copy; |
570 } | 570 } |
571 | 571 |
572 | 572 |
573 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) { | 573 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CreateArrayLiteral) { |
574 HandleScope scope(isolate); | 574 HandleScope scope(isolate); |
575 ASSERT(args.length() == 4); | 575 ASSERT(args.length() == 4); |
576 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 576 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
577 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 577 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
578 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); | 578 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); |
579 CONVERT_SMI_ARG_CHECKED(flags, 3); | 579 CONVERT_SMI_ARG_CHECKED(flags, 3); |
580 | 580 |
581 return CreateArrayLiteralImpl(isolate, literals, literals_index, elements, | 581 return CreateArrayLiteralImpl(isolate, literals, literals_index, elements, |
582 flags); | 582 flags); |
583 } | 583 } |
584 | 584 |
585 | 585 |
586 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralStubBailout) { | 586 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CreateArrayLiteralStubBailout) { |
587 HandleScope scope(isolate); | 587 HandleScope scope(isolate); |
588 ASSERT(args.length() == 3); | 588 ASSERT(args.length() == 3); |
589 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 589 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
590 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 590 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
591 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); | 591 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); |
592 | 592 |
593 return CreateArrayLiteralImpl(isolate, literals, literals_index, elements, | 593 return CreateArrayLiteralImpl(isolate, literals, literals_index, elements, |
594 ArrayLiteral::kShallowElements); | 594 ArrayLiteral::kShallowElements); |
595 } | 595 } |
596 | 596 |
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2072 | 2072 |
2073 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAccessorProperty) { | 2073 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAccessorProperty) { |
2074 HandleScope scope(isolate); | 2074 HandleScope scope(isolate); |
2075 ASSERT(args.length() == 6); | 2075 ASSERT(args.length() == 6); |
2076 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 2076 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
2077 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 2077 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
2078 CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2); | 2078 CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2); |
2079 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); | 2079 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); |
2080 CONVERT_SMI_ARG_CHECKED(attribute, 4); | 2080 CONVERT_SMI_ARG_CHECKED(attribute, 4); |
2081 CONVERT_SMI_ARG_CHECKED(access_control, 5); | 2081 CONVERT_SMI_ARG_CHECKED(access_control, 5); |
| 2082 RUNTIME_ASSERT(getter->IsUndefined() || getter->IsFunctionTemplateInfo()); |
| 2083 RUNTIME_ASSERT(setter->IsUndefined() || setter->IsFunctionTemplateInfo()); |
2082 JSObject::DefineAccessor(object, | 2084 JSObject::DefineAccessor(object, |
2083 name, | 2085 name, |
2084 InstantiateAccessorComponent(isolate, getter), | 2086 InstantiateAccessorComponent(isolate, getter), |
2085 InstantiateAccessorComponent(isolate, setter), | 2087 InstantiateAccessorComponent(isolate, setter), |
2086 static_cast<PropertyAttributes>(attribute), | 2088 static_cast<PropertyAttributes>(attribute), |
2087 static_cast<v8::AccessControl>(access_control)); | 2089 static_cast<v8::AccessControl>(access_control)); |
2088 return isolate->heap()->undefined_value(); | 2090 return isolate->heap()->undefined_value(); |
2089 } | 2091 } |
2090 | 2092 |
2091 | 2093 |
2092 static Failure* ThrowRedeclarationError(Isolate* isolate, | 2094 static Failure* ThrowRedeclarationError(Isolate* isolate, |
2093 const char* type, | 2095 const char* type, |
2094 Handle<String> name) { | 2096 Handle<String> name) { |
2095 HandleScope scope(isolate); | 2097 HandleScope scope(isolate); |
2096 Handle<Object> type_handle = | 2098 Handle<Object> type_handle = |
2097 isolate->factory()->NewStringFromAscii(CStrVector(type)); | 2099 isolate->factory()->NewStringFromAscii(CStrVector(type)); |
2098 Handle<Object> args[2] = { type_handle, name }; | 2100 Handle<Object> args[2] = { type_handle, name }; |
2099 Handle<Object> error = | 2101 Handle<Object> error = |
2100 isolate->factory()->NewTypeError("redeclaration", HandleVector(args, 2)); | 2102 isolate->factory()->NewTypeError("redeclaration", HandleVector(args, 2)); |
2101 return isolate->Throw(*error); | 2103 return isolate->Throw(*error); |
2102 } | 2104 } |
2103 | 2105 |
2104 | 2106 |
2105 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) { | 2107 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_DeclareGlobals) { |
2106 HandleScope scope(isolate); | 2108 HandleScope scope(isolate); |
2107 ASSERT(args.length() == 3); | 2109 ASSERT(args.length() == 3); |
2108 Handle<GlobalObject> global = Handle<GlobalObject>( | 2110 Handle<GlobalObject> global = Handle<GlobalObject>( |
2109 isolate->context()->global_object()); | 2111 isolate->context()->global_object()); |
2110 | 2112 |
2111 Handle<Context> context = args.at<Context>(0); | 2113 Handle<Context> context = args.at<Context>(0); |
2112 CONVERT_ARG_HANDLE_CHECKED(FixedArray, pairs, 1); | 2114 CONVERT_ARG_HANDLE_CHECKED(FixedArray, pairs, 1); |
2113 CONVERT_SMI_ARG_CHECKED(flags, 2); | 2115 CONVERT_SMI_ARG_CHECKED(flags, 2); |
2114 | 2116 |
2115 // Traverse the name/value pairs and set the properties. | 2117 // Traverse the name/value pairs and set the properties. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2190 global, name, value, static_cast<PropertyAttributes>(attr), | 2192 global, name, value, static_cast<PropertyAttributes>(attr), |
2191 strict_mode)); | 2193 strict_mode)); |
2192 } | 2194 } |
2193 } | 2195 } |
2194 | 2196 |
2195 ASSERT(!isolate->has_pending_exception()); | 2197 ASSERT(!isolate->has_pending_exception()); |
2196 return isolate->heap()->undefined_value(); | 2198 return isolate->heap()->undefined_value(); |
2197 } | 2199 } |
2198 | 2200 |
2199 | 2201 |
2200 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareContextSlot) { | 2202 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_DeclareContextSlot) { |
2201 HandleScope scope(isolate); | 2203 HandleScope scope(isolate); |
2202 ASSERT(args.length() == 4); | 2204 ASSERT(args.length() == 4); |
2203 | 2205 |
2204 // Declarations are always made in a function or native context. In the | 2206 // Declarations are always made in a function or native context. In the |
2205 // case of eval code, the context passed is the context of the caller, | 2207 // case of eval code, the context passed is the context of the caller, |
2206 // which may be some nested context and not the declaration context. | 2208 // which may be some nested context and not the declaration context. |
2207 RUNTIME_ASSERT(args[0]->IsContext()); | 2209 RUNTIME_ASSERT(args[0]->IsContext()); |
2208 Handle<Context> context(Context::cast(args[0])->declaration_context()); | 2210 Handle<Context> context(Context::cast(args[0])->declaration_context()); |
2209 | 2211 |
2210 Handle<String> name(String::cast(args[1])); | 2212 Handle<String> name(String::cast(args[1])); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2349 Handle<GlobalObject> global(isolate->context()->global_object()); | 2351 Handle<GlobalObject> global(isolate->context()->global_object()); |
2350 Handle<Object> result = JSReceiver::SetProperty( | 2352 Handle<Object> result = JSReceiver::SetProperty( |
2351 global, name, value, attributes, strict_mode); | 2353 global, name, value, attributes, strict_mode); |
2352 RETURN_IF_EMPTY_HANDLE(isolate, result); | 2354 RETURN_IF_EMPTY_HANDLE(isolate, result); |
2353 return *result; | 2355 return *result; |
2354 } | 2356 } |
2355 return isolate->heap()->undefined_value(); | 2357 return isolate->heap()->undefined_value(); |
2356 } | 2358 } |
2357 | 2359 |
2358 | 2360 |
2359 RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) { | 2361 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_InitializeConstGlobal) { |
2360 SealHandleScope shs(isolate); | 2362 SealHandleScope shs(isolate); |
2361 // All constants are declared with an initial value. The name | 2363 // All constants are declared with an initial value. The name |
2362 // of the constant is the first argument and the initial value | 2364 // of the constant is the first argument and the initial value |
2363 // is the second. | 2365 // is the second. |
2364 RUNTIME_ASSERT(args.length() == 2); | 2366 RUNTIME_ASSERT(args.length() == 2); |
2365 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 2367 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
2366 Handle<Object> value = args.at<Object>(1); | 2368 Handle<Object> value = args.at<Object>(1); |
2367 | 2369 |
2368 // Get the current global object from top. | 2370 // Get the current global object from top. |
2369 GlobalObject* global = isolate->context()->global_object(); | 2371 GlobalObject* global = isolate->context()->global_object(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2426 // Ignore re-initialization of constants that have already been | 2428 // Ignore re-initialization of constants that have already been |
2427 // assigned a constant value. | 2429 // assigned a constant value. |
2428 ASSERT(lookup.IsReadOnly() && lookup.IsConstant()); | 2430 ASSERT(lookup.IsReadOnly() && lookup.IsConstant()); |
2429 } | 2431 } |
2430 | 2432 |
2431 // Use the set value as the result of the operation. | 2433 // Use the set value as the result of the operation. |
2432 return *value; | 2434 return *value; |
2433 } | 2435 } |
2434 | 2436 |
2435 | 2437 |
2436 RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstContextSlot) { | 2438 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_InitializeConstContextSlot) { |
2437 HandleScope scope(isolate); | 2439 HandleScope scope(isolate); |
2438 ASSERT(args.length() == 3); | 2440 ASSERT(args.length() == 3); |
2439 | 2441 |
2440 Handle<Object> value(args[0], isolate); | 2442 Handle<Object> value(args[0], isolate); |
2441 ASSERT(!value->IsTheHole()); | 2443 ASSERT(!value->IsTheHole()); |
2442 | 2444 |
2443 // Initializations are always done in a function or native context. | 2445 // Initializations are always done in a function or native context. |
2444 RUNTIME_ASSERT(args[1]->IsContext()); | 2446 RUNTIME_ASSERT(args[1]->IsContext()); |
2445 Handle<Context> context(Context::cast(args[1])->declaration_context()); | 2447 Handle<Context> context(Context::cast(args[1])->declaration_context()); |
2446 | 2448 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2744 } | 2746 } |
2745 // Returns undefined for strict or native functions, or | 2747 // Returns undefined for strict or native functions, or |
2746 // the associated global receiver for "normal" functions. | 2748 // the associated global receiver for "normal" functions. |
2747 | 2749 |
2748 Context* native_context = | 2750 Context* native_context = |
2749 function->context()->global_object()->native_context(); | 2751 function->context()->global_object()->native_context(); |
2750 return native_context->global_object()->global_receiver(); | 2752 return native_context->global_object()->global_receiver(); |
2751 } | 2753 } |
2752 | 2754 |
2753 | 2755 |
2754 RUNTIME_FUNCTION(MaybeObject*, Runtime_MaterializeRegExpLiteral) { | 2756 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_MaterializeRegExpLiteral) { |
2755 HandleScope scope(isolate); | 2757 HandleScope scope(isolate); |
2756 ASSERT(args.length() == 4); | 2758 ASSERT(args.length() == 4); |
2757 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 2759 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
2758 int index = args.smi_at(1); | 2760 int index = args.smi_at(1); |
2759 Handle<String> pattern = args.at<String>(2); | 2761 Handle<String> pattern = args.at<String>(2); |
2760 Handle<String> flags = args.at<String>(3); | 2762 Handle<String> flags = args.at<String>(3); |
2761 | 2763 |
2762 // Get the RegExp function from the context in the literals array. | 2764 // Get the RegExp function from the context in the literals array. |
2763 // This is the RegExp function from the context in which the | 2765 // This is the RegExp function from the context in which the |
2764 // function was created. We do not use the RegExp function from the | 2766 // function was created. We do not use the RegExp function from the |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3062 func->GetIsolate()->factory()->CopyMap( | 3064 func->GetIsolate()->factory()->CopyMap( |
3063 Handle<Map>(func->initial_map())); | 3065 Handle<Map>(func->initial_map())); |
3064 new_initial_map->set_unused_property_fields(num); | 3066 new_initial_map->set_unused_property_fields(num); |
3065 func->set_initial_map(*new_initial_map); | 3067 func->set_initial_map(*new_initial_map); |
3066 } | 3068 } |
3067 } | 3069 } |
3068 return isolate->heap()->undefined_value(); | 3070 return isolate->heap()->undefined_value(); |
3069 } | 3071 } |
3070 | 3072 |
3071 | 3073 |
3072 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSGeneratorObject) { | 3074 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CreateJSGeneratorObject) { |
3073 HandleScope scope(isolate); | 3075 HandleScope scope(isolate); |
3074 ASSERT(args.length() == 0); | 3076 ASSERT(args.length() == 0); |
3075 | 3077 |
3076 JavaScriptFrameIterator it(isolate); | 3078 JavaScriptFrameIterator it(isolate); |
3077 JavaScriptFrame* frame = it.frame(); | 3079 JavaScriptFrame* frame = it.frame(); |
3078 Handle<JSFunction> function(frame->function()); | 3080 Handle<JSFunction> function(frame->function()); |
3079 RUNTIME_ASSERT(function->shared()->is_generator()); | 3081 RUNTIME_ASSERT(function->shared()->is_generator()); |
3080 | 3082 |
3081 Handle<JSGeneratorObject> generator; | 3083 Handle<JSGeneratorObject> generator; |
3082 if (frame->IsConstructor()) { | 3084 if (frame->IsConstructor()) { |
3083 generator = handle(JSGeneratorObject::cast(frame->receiver())); | 3085 generator = handle(JSGeneratorObject::cast(frame->receiver())); |
3084 } else { | 3086 } else { |
3085 generator = isolate->factory()->NewJSGeneratorObject(function); | 3087 generator = isolate->factory()->NewJSGeneratorObject(function); |
3086 } | 3088 } |
3087 generator->set_function(*function); | 3089 generator->set_function(*function); |
3088 generator->set_context(Context::cast(frame->context())); | 3090 generator->set_context(Context::cast(frame->context())); |
3089 generator->set_receiver(frame->receiver()); | 3091 generator->set_receiver(frame->receiver()); |
3090 generator->set_continuation(0); | 3092 generator->set_continuation(0); |
3091 generator->set_operand_stack(isolate->heap()->empty_fixed_array()); | 3093 generator->set_operand_stack(isolate->heap()->empty_fixed_array()); |
3092 generator->set_stack_handler_index(-1); | 3094 generator->set_stack_handler_index(-1); |
3093 | 3095 |
3094 return *generator; | 3096 return *generator; |
3095 } | 3097 } |
3096 | 3098 |
3097 | 3099 |
3098 RUNTIME_FUNCTION(MaybeObject*, Runtime_SuspendJSGeneratorObject) { | 3100 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_SuspendJSGeneratorObject) { |
3099 SealHandleScope shs(isolate); | 3101 SealHandleScope shs(isolate); |
3100 ASSERT(args.length() == 1); | 3102 ASSERT(args.length() == 1); |
3101 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0); | 3103 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0); |
3102 | 3104 |
3103 JavaScriptFrameIterator stack_iterator(isolate); | 3105 JavaScriptFrameIterator stack_iterator(isolate); |
3104 JavaScriptFrame* frame = stack_iterator.frame(); | 3106 JavaScriptFrame* frame = stack_iterator.frame(); |
3105 RUNTIME_ASSERT(frame->function()->shared()->is_generator()); | 3107 RUNTIME_ASSERT(frame->function()->shared()->is_generator()); |
3106 ASSERT_EQ(frame->function(), generator_object->function()); | 3108 ASSERT_EQ(frame->function(), generator_object->function()); |
3107 | 3109 |
3108 // The caller should have saved the context and continuation already. | 3110 // The caller should have saved the context and continuation already. |
(...skipping 30 matching lines...) Expand all Loading... |
3139 } | 3141 } |
3140 | 3142 |
3141 | 3143 |
3142 // Note that this function is the slow path for resuming generators. It is only | 3144 // Note that this function is the slow path for resuming generators. It is only |
3143 // called if the suspended activation had operands on the stack, stack handlers | 3145 // called if the suspended activation had operands on the stack, stack handlers |
3144 // needing rewinding, or if the resume should throw an exception. The fast path | 3146 // needing rewinding, or if the resume should throw an exception. The fast path |
3145 // is handled directly in FullCodeGenerator::EmitGeneratorResume(), which is | 3147 // is handled directly in FullCodeGenerator::EmitGeneratorResume(), which is |
3146 // inlined into GeneratorNext and GeneratorThrow. EmitGeneratorResumeResume is | 3148 // inlined into GeneratorNext and GeneratorThrow. EmitGeneratorResumeResume is |
3147 // called in any case, as it needs to reconstruct the stack frame and make space | 3149 // called in any case, as it needs to reconstruct the stack frame and make space |
3148 // for arguments and operands. | 3150 // for arguments and operands. |
3149 RUNTIME_FUNCTION(MaybeObject*, Runtime_ResumeJSGeneratorObject) { | 3151 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_ResumeJSGeneratorObject) { |
3150 SealHandleScope shs(isolate); | 3152 SealHandleScope shs(isolate); |
3151 ASSERT(args.length() == 3); | 3153 ASSERT(args.length() == 3); |
3152 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0); | 3154 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0); |
3153 CONVERT_ARG_CHECKED(Object, value, 1); | 3155 CONVERT_ARG_CHECKED(Object, value, 1); |
3154 CONVERT_SMI_ARG_CHECKED(resume_mode_int, 2); | 3156 CONVERT_SMI_ARG_CHECKED(resume_mode_int, 2); |
3155 JavaScriptFrameIterator stack_iterator(isolate); | 3157 JavaScriptFrameIterator stack_iterator(isolate); |
3156 JavaScriptFrame* frame = stack_iterator.frame(); | 3158 JavaScriptFrame* frame = stack_iterator.frame(); |
3157 | 3159 |
3158 ASSERT_EQ(frame->function(), generator_object->function()); | 3160 ASSERT_EQ(frame->function(), generator_object->function()); |
3159 ASSERT(frame->function()->is_compiled()); | 3161 ASSERT(frame->function()->is_compiled()); |
(...skipping 27 matching lines...) Expand all Loading... |
3187 return value; | 3189 return value; |
3188 case JSGeneratorObject::THROW: | 3190 case JSGeneratorObject::THROW: |
3189 return isolate->Throw(value); | 3191 return isolate->Throw(value); |
3190 } | 3192 } |
3191 | 3193 |
3192 UNREACHABLE(); | 3194 UNREACHABLE(); |
3193 return isolate->ThrowIllegalOperation(); | 3195 return isolate->ThrowIllegalOperation(); |
3194 } | 3196 } |
3195 | 3197 |
3196 | 3198 |
3197 RUNTIME_FUNCTION(MaybeObject*, Runtime_ThrowGeneratorStateError) { | 3199 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_ThrowGeneratorStateError) { |
3198 HandleScope scope(isolate); | 3200 HandleScope scope(isolate); |
3199 ASSERT(args.length() == 1); | 3201 ASSERT(args.length() == 1); |
3200 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); | 3202 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); |
3201 int continuation = generator->continuation(); | 3203 int continuation = generator->continuation(); |
3202 const char* message = continuation == JSGeneratorObject::kGeneratorClosed ? | 3204 const char* message = continuation == JSGeneratorObject::kGeneratorClosed ? |
3203 "generator_finished" : "generator_running"; | 3205 "generator_finished" : "generator_running"; |
3204 Vector< Handle<Object> > argv = HandleVector<Object>(NULL, 0); | 3206 Vector< Handle<Object> > argv = HandleVector<Object>(NULL, 0); |
3205 Handle<Object> error = isolate->factory()->NewError(message, argv); | 3207 Handle<Object> error = isolate->factory()->NewError(message, argv); |
3206 return isolate->Throw(*error); | 3208 return isolate->Throw(*error); |
3207 } | 3209 } |
(...skipping 3657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6865 SealHandleScope shs(isolate); | 6867 SealHandleScope shs(isolate); |
6866 ASSERT(args.length() == 1); | 6868 ASSERT(args.length() == 1); |
6867 | 6869 |
6868 Object* number = args[0]; | 6870 Object* number = args[0]; |
6869 RUNTIME_ASSERT(number->IsNumber()); | 6871 RUNTIME_ASSERT(number->IsNumber()); |
6870 | 6872 |
6871 return isolate->heap()->NumberToString(number); | 6873 return isolate->heap()->NumberToString(number); |
6872 } | 6874 } |
6873 | 6875 |
6874 | 6876 |
6875 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToStringSkipCache) { | 6877 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NumberToStringSkipCache) { |
6876 SealHandleScope shs(isolate); | 6878 SealHandleScope shs(isolate); |
6877 ASSERT(args.length() == 1); | 6879 ASSERT(args.length() == 1); |
6878 | 6880 |
6879 Object* number = args[0]; | 6881 Object* number = args[0]; |
6880 RUNTIME_ASSERT(number->IsNumber()); | 6882 RUNTIME_ASSERT(number->IsNumber()); |
6881 | 6883 |
6882 return isolate->heap()->NumberToString(number, false); | 6884 return isolate->heap()->NumberToString(number, false); |
6883 } | 6885 } |
6884 | 6886 |
6885 | 6887 |
6886 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToInteger) { | 6888 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToInteger) { |
6887 SealHandleScope shs(isolate); | 6889 SealHandleScope shs(isolate); |
6888 ASSERT(args.length() == 1); | 6890 ASSERT(args.length() == 1); |
6889 | 6891 |
6890 CONVERT_DOUBLE_ARG_CHECKED(number, 0); | 6892 CONVERT_DOUBLE_ARG_CHECKED(number, 0); |
6891 | 6893 |
6892 // We do not include 0 so that we don't have to treat +0 / -0 cases. | 6894 // We do not include 0 so that we don't have to treat +0 / -0 cases. |
6893 if (number > 0 && number <= Smi::kMaxValue) { | 6895 if (number > 0 && number <= Smi::kMaxValue) { |
6894 return Smi::FromInt(static_cast<int>(number)); | 6896 return Smi::FromInt(static_cast<int>(number)); |
6895 } | 6897 } |
6896 return isolate->heap()->NumberFromDouble(DoubleToInteger(number)); | 6898 return isolate->heap()->NumberFromDouble(DoubleToInteger(number)); |
6897 } | 6899 } |
6898 | 6900 |
6899 | 6901 |
6900 // ES6 draft 9.1.11 | |
6901 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToPositiveInteger) { | |
6902 SealHandleScope shs(isolate); | |
6903 ASSERT(args.length() == 1); | |
6904 | |
6905 CONVERT_DOUBLE_ARG_CHECKED(number, 0); | |
6906 | |
6907 // We do not include 0 so that we don't have to treat +0 / -0 cases. | |
6908 if (number > 0 && number <= Smi::kMaxValue) { | |
6909 return Smi::FromInt(static_cast<int>(number)); | |
6910 } | |
6911 if (number <= 0) { | |
6912 return Smi::FromInt(0); | |
6913 } | |
6914 return isolate->heap()->NumberFromDouble(DoubleToInteger(number)); | |
6915 } | |
6916 | |
6917 | |
6918 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToIntegerMapMinusZero) { | 6902 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToIntegerMapMinusZero) { |
6919 SealHandleScope shs(isolate); | 6903 SealHandleScope shs(isolate); |
6920 ASSERT(args.length() == 1); | 6904 ASSERT(args.length() == 1); |
6921 | 6905 |
6922 CONVERT_DOUBLE_ARG_CHECKED(number, 0); | 6906 CONVERT_DOUBLE_ARG_CHECKED(number, 0); |
6923 | 6907 |
6924 // We do not include 0 so that we don't have to treat +0 / -0 cases. | 6908 // We do not include 0 so that we don't have to treat +0 / -0 cases. |
6925 if (number > 0 && number <= Smi::kMaxValue) { | 6909 if (number > 0 && number <= Smi::kMaxValue) { |
6926 return Smi::FromInt(static_cast<int>(number)); | 6910 return Smi::FromInt(static_cast<int>(number)); |
6927 } | 6911 } |
(...skipping 24 matching lines...) Expand all Loading... |
6952 // We do not include 0 so that we don't have to treat +0 / -0 cases. | 6936 // We do not include 0 so that we don't have to treat +0 / -0 cases. |
6953 if (number > 0 && number <= Smi::kMaxValue) { | 6937 if (number > 0 && number <= Smi::kMaxValue) { |
6954 return Smi::FromInt(static_cast<int>(number)); | 6938 return Smi::FromInt(static_cast<int>(number)); |
6955 } | 6939 } |
6956 return isolate->heap()->NumberFromInt32(DoubleToInt32(number)); | 6940 return isolate->heap()->NumberFromInt32(DoubleToInt32(number)); |
6957 } | 6941 } |
6958 | 6942 |
6959 | 6943 |
6960 // Converts a Number to a Smi, if possible. Returns NaN if the number is not | 6944 // Converts a Number to a Smi, if possible. Returns NaN if the number is not |
6961 // a small integer. | 6945 // a small integer. |
6962 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToSmi) { | 6946 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NumberToSmi) { |
6963 SealHandleScope shs(isolate); | 6947 SealHandleScope shs(isolate); |
6964 ASSERT(args.length() == 1); | 6948 ASSERT(args.length() == 1); |
6965 | 6949 |
6966 Object* obj = args[0]; | 6950 Object* obj = args[0]; |
6967 if (obj->IsSmi()) { | 6951 if (obj->IsSmi()) { |
6968 return obj; | 6952 return obj; |
6969 } | 6953 } |
6970 if (obj->IsHeapNumber()) { | 6954 if (obj->IsHeapNumber()) { |
6971 double value = HeapNumber::cast(obj)->value(); | 6955 double value = HeapNumber::cast(obj)->value(); |
6972 int int_value = FastD2I(value); | 6956 int int_value = FastD2I(value); |
6973 if (value == FastI2D(int_value) && Smi::IsValid(int_value)) { | 6957 if (value == FastI2D(int_value) && Smi::IsValid(int_value)) { |
6974 return Smi::FromInt(int_value); | 6958 return Smi::FromInt(int_value); |
6975 } | 6959 } |
6976 } | 6960 } |
6977 return isolate->heap()->nan_value(); | 6961 return isolate->heap()->nan_value(); |
6978 } | 6962 } |
6979 | 6963 |
6980 | 6964 |
6981 RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateHeapNumber) { | 6965 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_AllocateHeapNumber) { |
6982 SealHandleScope shs(isolate); | 6966 SealHandleScope shs(isolate); |
6983 ASSERT(args.length() == 0); | 6967 ASSERT(args.length() == 0); |
6984 return isolate->heap()->AllocateHeapNumber(0); | 6968 return isolate->heap()->AllocateHeapNumber(0); |
6985 } | 6969 } |
6986 | 6970 |
6987 | 6971 |
6988 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberAdd) { | 6972 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberAdd) { |
6989 SealHandleScope shs(isolate); | 6973 SealHandleScope shs(isolate); |
6990 ASSERT(args.length() == 2); | 6974 ASSERT(args.length() == 2); |
6991 | 6975 |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7961 MaybeObject* maybe_result = | 7945 MaybeObject* maybe_result = |
7962 isolate->heap()->AllocateHeapNumber(DoubleToInteger(time)); | 7946 isolate->heap()->AllocateHeapNumber(DoubleToInteger(time)); |
7963 if (!maybe_result->ToObject(&value)) return maybe_result; | 7947 if (!maybe_result->ToObject(&value)) return maybe_result; |
7964 } | 7948 } |
7965 } | 7949 } |
7966 date->SetValue(value, is_value_nan); | 7950 date->SetValue(value, is_value_nan); |
7967 return value; | 7951 return value; |
7968 } | 7952 } |
7969 | 7953 |
7970 | 7954 |
7971 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewArgumentsFast) { | 7955 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewArgumentsFast) { |
7972 HandleScope scope(isolate); | 7956 HandleScope scope(isolate); |
7973 ASSERT(args.length() == 3); | 7957 ASSERT(args.length() == 3); |
7974 | 7958 |
7975 Handle<JSFunction> callee = args.at<JSFunction>(0); | 7959 Handle<JSFunction> callee = args.at<JSFunction>(0); |
7976 Object** parameters = reinterpret_cast<Object**>(args[1]); | 7960 Object** parameters = reinterpret_cast<Object**>(args[1]); |
7977 const int argument_count = Smi::cast(args[2])->value(); | 7961 const int argument_count = Smi::cast(args[2])->value(); |
7978 | 7962 |
7979 Handle<JSObject> result = | 7963 Handle<JSObject> result = |
7980 isolate->factory()->NewArgumentsObject(callee, argument_count); | 7964 isolate->factory()->NewArgumentsObject(callee, argument_count); |
7981 // Allocate the elements if needed. | 7965 // Allocate the elements if needed. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8056 result->set_elements(*elements); | 8040 result->set_elements(*elements); |
8057 for (int i = 0; i < argument_count; ++i) { | 8041 for (int i = 0; i < argument_count; ++i) { |
8058 elements->set(i, *(parameters - i - 1)); | 8042 elements->set(i, *(parameters - i - 1)); |
8059 } | 8043 } |
8060 } | 8044 } |
8061 } | 8045 } |
8062 return *result; | 8046 return *result; |
8063 } | 8047 } |
8064 | 8048 |
8065 | 8049 |
8066 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewStrictArgumentsFast) { | 8050 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewStrictArgumentsFast) { |
8067 SealHandleScope shs(isolate); | 8051 SealHandleScope shs(isolate); |
8068 ASSERT(args.length() == 3); | 8052 ASSERT(args.length() == 3); |
8069 | 8053 |
8070 JSFunction* callee = JSFunction::cast(args[0]); | 8054 JSFunction* callee = JSFunction::cast(args[0]); |
8071 Object** parameters = reinterpret_cast<Object**>(args[1]); | 8055 Object** parameters = reinterpret_cast<Object**>(args[1]); |
8072 const int length = args.smi_at(2); | 8056 const int length = args.smi_at(2); |
8073 | 8057 |
8074 Object* result; | 8058 Object* result; |
8075 { MaybeObject* maybe_result = | 8059 { MaybeObject* maybe_result = |
8076 isolate->heap()->AllocateArgumentsObject(callee, length); | 8060 isolate->heap()->AllocateArgumentsObject(callee, length); |
(...skipping 12 matching lines...) Expand all Loading... |
8089 WriteBarrierMode mode = array->GetWriteBarrierMode(no_gc); | 8073 WriteBarrierMode mode = array->GetWriteBarrierMode(no_gc); |
8090 for (int i = 0; i < length; i++) { | 8074 for (int i = 0; i < length; i++) { |
8091 array->set(i, *--parameters, mode); | 8075 array->set(i, *--parameters, mode); |
8092 } | 8076 } |
8093 JSObject::cast(result)->set_elements(array); | 8077 JSObject::cast(result)->set_elements(array); |
8094 } | 8078 } |
8095 return result; | 8079 return result; |
8096 } | 8080 } |
8097 | 8081 |
8098 | 8082 |
8099 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewClosureFromStubFailure) { | 8083 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewClosureFromStubFailure) { |
8100 HandleScope scope(isolate); | 8084 HandleScope scope(isolate); |
8101 ASSERT(args.length() == 1); | 8085 ASSERT(args.length() == 1); |
8102 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); | 8086 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); |
8103 Handle<Context> context(isolate->context()); | 8087 Handle<Context> context(isolate->context()); |
8104 PretenureFlag pretenure_flag = NOT_TENURED; | 8088 PretenureFlag pretenure_flag = NOT_TENURED; |
8105 Handle<JSFunction> result = | 8089 Handle<JSFunction> result = |
8106 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, | 8090 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, |
8107 context, | 8091 context, |
8108 pretenure_flag); | 8092 pretenure_flag); |
8109 return *result; | 8093 return *result; |
8110 } | 8094 } |
8111 | 8095 |
8112 | 8096 |
8113 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewClosure) { | 8097 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewClosure) { |
8114 HandleScope scope(isolate); | 8098 HandleScope scope(isolate); |
8115 ASSERT(args.length() == 3); | 8099 ASSERT(args.length() == 3); |
8116 CONVERT_ARG_HANDLE_CHECKED(Context, context, 0); | 8100 CONVERT_ARG_HANDLE_CHECKED(Context, context, 0); |
8117 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 1); | 8101 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 1); |
8118 CONVERT_BOOLEAN_ARG_CHECKED(pretenure, 2); | 8102 CONVERT_BOOLEAN_ARG_CHECKED(pretenure, 2); |
8119 | 8103 |
8120 // The caller ensures that we pretenure closures that are assigned | 8104 // The caller ensures that we pretenure closures that are assigned |
8121 // directly to properties. | 8105 // directly to properties. |
8122 PretenureFlag pretenure_flag = pretenure ? TENURED : NOT_TENURED; | 8106 PretenureFlag pretenure_flag = pretenure ? TENURED : NOT_TENURED; |
8123 Handle<JSFunction> result = | 8107 Handle<JSFunction> result = |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8369 } | 8353 } |
8370 RETURN_IF_EMPTY_HANDLE(isolate, result); | 8354 RETURN_IF_EMPTY_HANDLE(isolate, result); |
8371 | 8355 |
8372 isolate->counters()->constructed_objects()->Increment(); | 8356 isolate->counters()->constructed_objects()->Increment(); |
8373 isolate->counters()->constructed_objects_runtime()->Increment(); | 8357 isolate->counters()->constructed_objects_runtime()->Increment(); |
8374 | 8358 |
8375 return *result; | 8359 return *result; |
8376 } | 8360 } |
8377 | 8361 |
8378 | 8362 |
8379 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObject) { | 8363 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewObject) { |
8380 HandleScope scope(isolate); | 8364 HandleScope scope(isolate); |
8381 ASSERT(args.length() == 1); | 8365 ASSERT(args.length() == 1); |
8382 | 8366 |
8383 Handle<Object> constructor = args.at<Object>(0); | 8367 Handle<Object> constructor = args.at<Object>(0); |
8384 return Runtime_NewObjectHelper(isolate, | 8368 return Runtime_NewObjectHelper(isolate, |
8385 constructor, | 8369 constructor, |
8386 Handle<AllocationSite>::null()); | 8370 Handle<AllocationSite>::null()); |
8387 } | 8371 } |
8388 | 8372 |
8389 | 8373 |
8390 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObjectWithAllocationSite) { | 8374 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewObjectWithAllocationSite) { |
8391 HandleScope scope(isolate); | 8375 HandleScope scope(isolate); |
8392 ASSERT(args.length() == 2); | 8376 ASSERT(args.length() == 2); |
8393 | 8377 |
8394 Handle<Object> constructor = args.at<Object>(1); | 8378 Handle<Object> constructor = args.at<Object>(1); |
8395 Handle<Object> feedback = args.at<Object>(0); | 8379 Handle<Object> feedback = args.at<Object>(0); |
8396 Handle<AllocationSite> site; | 8380 Handle<AllocationSite> site; |
8397 if (feedback->IsAllocationSite()) { | 8381 if (feedback->IsAllocationSite()) { |
8398 // The feedback can be an AllocationSite or undefined. | 8382 // The feedback can be an AllocationSite or undefined. |
8399 site = Handle<AllocationSite>::cast(feedback); | 8383 site = Handle<AllocationSite>::cast(feedback); |
8400 } | 8384 } |
8401 return Runtime_NewObjectHelper(isolate, | 8385 return Runtime_NewObjectHelper(isolate, |
8402 constructor, | 8386 constructor, |
8403 site); | 8387 site); |
8404 } | 8388 } |
8405 | 8389 |
8406 | 8390 |
8407 RUNTIME_FUNCTION(MaybeObject*, Runtime_FinalizeInstanceSize) { | 8391 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_FinalizeInstanceSize) { |
8408 HandleScope scope(isolate); | 8392 HandleScope scope(isolate); |
8409 ASSERT(args.length() == 1); | 8393 ASSERT(args.length() == 1); |
8410 | 8394 |
8411 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8395 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8412 function->shared()->CompleteInobjectSlackTracking(); | 8396 function->shared()->CompleteInobjectSlackTracking(); |
8413 | 8397 |
8414 return isolate->heap()->undefined_value(); | 8398 return isolate->heap()->undefined_value(); |
8415 } | 8399 } |
8416 | 8400 |
8417 | 8401 |
8418 RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileUnoptimized) { | 8402 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CompileUnoptimized) { |
8419 HandleScope scope(isolate); | 8403 HandleScope scope(isolate); |
8420 ASSERT(args.length() == 1); | 8404 ASSERT(args.length() == 1); |
8421 | 8405 |
8422 Handle<JSFunction> function = args.at<JSFunction>(0); | 8406 Handle<JSFunction> function = args.at<JSFunction>(0); |
8423 #ifdef DEBUG | 8407 #ifdef DEBUG |
8424 if (FLAG_trace_lazy && !function->shared()->is_compiled()) { | 8408 if (FLAG_trace_lazy && !function->shared()->is_compiled()) { |
8425 PrintF("[unoptimized: "); | 8409 PrintF("[unoptimized: "); |
8426 function->PrintName(); | 8410 function->PrintName(); |
8427 PrintF("]\n"); | 8411 PrintF("]\n"); |
8428 } | 8412 } |
8429 #endif | 8413 #endif |
8430 | 8414 |
8431 // Compile the target function. | 8415 // Compile the target function. |
8432 ASSERT(function->shared()->allows_lazy_compilation()); | 8416 ASSERT(function->shared()->allows_lazy_compilation()); |
8433 | 8417 |
8434 Handle<Code> code = Compiler::GetUnoptimizedCode(function); | 8418 Handle<Code> code = Compiler::GetUnoptimizedCode(function); |
8435 RETURN_IF_EMPTY_HANDLE(isolate, code); | 8419 RETURN_IF_EMPTY_HANDLE(isolate, code); |
8436 function->ReplaceCode(*code); | 8420 function->ReplaceCode(*code); |
8437 | 8421 |
8438 // All done. Return the compiled code. | 8422 // All done. Return the compiled code. |
8439 ASSERT(function->is_compiled()); | 8423 ASSERT(function->is_compiled()); |
8440 ASSERT(function->code()->kind() == Code::FUNCTION || | 8424 ASSERT(function->code()->kind() == Code::FUNCTION || |
8441 (FLAG_always_opt && | 8425 (FLAG_always_opt && |
8442 function->code()->kind() == Code::OPTIMIZED_FUNCTION)); | 8426 function->code()->kind() == Code::OPTIMIZED_FUNCTION)); |
8443 return *code; | 8427 return *code; |
8444 } | 8428 } |
8445 | 8429 |
8446 | 8430 |
8447 RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileOptimized) { | 8431 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CompileOptimized) { |
8448 HandleScope scope(isolate); | 8432 HandleScope scope(isolate); |
8449 ASSERT(args.length() == 2); | 8433 ASSERT(args.length() == 2); |
8450 Handle<JSFunction> function = args.at<JSFunction>(0); | 8434 Handle<JSFunction> function = args.at<JSFunction>(0); |
8451 CONVERT_BOOLEAN_ARG_CHECKED(concurrent, 1); | 8435 CONVERT_BOOLEAN_ARG_CHECKED(concurrent, 1); |
8452 | 8436 |
8453 Handle<Code> unoptimized(function->shared()->code()); | 8437 Handle<Code> unoptimized(function->shared()->code()); |
8454 if (!function->shared()->is_compiled()) { | 8438 if (!function->shared()->is_compiled()) { |
8455 // If the function is not compiled, do not optimize. | 8439 // If the function is not compiled, do not optimize. |
8456 // This can happen if the debugger is activated and | 8440 // This can happen if the debugger is activated and |
8457 // the function is returned to the not compiled state. | 8441 // the function is returned to the not compiled state. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8500 | 8484 |
8501 void VisitFrames(JavaScriptFrameIterator* it) { | 8485 void VisitFrames(JavaScriptFrameIterator* it) { |
8502 for (; !it->done(); it->Advance()) { | 8486 for (; !it->done(); it->Advance()) { |
8503 JavaScriptFrame* frame = it->frame(); | 8487 JavaScriptFrame* frame = it->frame(); |
8504 if (code_->contains(frame->pc())) has_code_activations_ = true; | 8488 if (code_->contains(frame->pc())) has_code_activations_ = true; |
8505 } | 8489 } |
8506 } | 8490 } |
8507 }; | 8491 }; |
8508 | 8492 |
8509 | 8493 |
8510 RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyStubFailure) { | 8494 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NotifyStubFailure) { |
8511 HandleScope scope(isolate); | 8495 HandleScope scope(isolate); |
8512 ASSERT(args.length() == 0); | 8496 ASSERT(args.length() == 0); |
8513 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); | 8497 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); |
8514 ASSERT(AllowHeapAllocation::IsAllowed()); | 8498 ASSERT(AllowHeapAllocation::IsAllowed()); |
8515 delete deoptimizer; | 8499 delete deoptimizer; |
8516 return isolate->heap()->undefined_value(); | 8500 return isolate->heap()->undefined_value(); |
8517 } | 8501 } |
8518 | 8502 |
8519 | 8503 |
8520 RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) { | 8504 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NotifyDeoptimized) { |
8521 HandleScope scope(isolate); | 8505 HandleScope scope(isolate); |
8522 ASSERT(args.length() == 1); | 8506 ASSERT(args.length() == 1); |
8523 RUNTIME_ASSERT(args[0]->IsSmi()); | 8507 RUNTIME_ASSERT(args[0]->IsSmi()); |
8524 Deoptimizer::BailoutType type = | 8508 Deoptimizer::BailoutType type = |
8525 static_cast<Deoptimizer::BailoutType>(args.smi_at(0)); | 8509 static_cast<Deoptimizer::BailoutType>(args.smi_at(0)); |
8526 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); | 8510 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); |
8527 ASSERT(AllowHeapAllocation::IsAllowed()); | 8511 ASSERT(AllowHeapAllocation::IsAllowed()); |
8528 | 8512 |
8529 Handle<JSFunction> function = deoptimizer->function(); | 8513 Handle<JSFunction> function = deoptimizer->function(); |
8530 Handle<Code> optimized_code = deoptimizer->compiled_code(); | 8514 Handle<Code> optimized_code = deoptimizer->compiled_code(); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8962 | 8946 |
8963 | 8947 |
8964 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetConstructorDelegate) { | 8948 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetConstructorDelegate) { |
8965 HandleScope scope(isolate); | 8949 HandleScope scope(isolate); |
8966 ASSERT(args.length() == 1); | 8950 ASSERT(args.length() == 1); |
8967 RUNTIME_ASSERT(!args[0]->IsJSFunction()); | 8951 RUNTIME_ASSERT(!args[0]->IsJSFunction()); |
8968 return *Execution::GetConstructorDelegate(isolate, args.at<Object>(0)); | 8952 return *Execution::GetConstructorDelegate(isolate, args.at<Object>(0)); |
8969 } | 8953 } |
8970 | 8954 |
8971 | 8955 |
8972 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewGlobalContext) { | 8956 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewGlobalContext) { |
8973 SealHandleScope shs(isolate); | 8957 SealHandleScope shs(isolate); |
8974 ASSERT(args.length() == 2); | 8958 ASSERT(args.length() == 2); |
8975 | 8959 |
8976 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 8960 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
8977 CONVERT_ARG_CHECKED(ScopeInfo, scope_info, 1); | 8961 CONVERT_ARG_CHECKED(ScopeInfo, scope_info, 1); |
8978 Context* result; | 8962 Context* result; |
8979 MaybeObject* maybe_result = | 8963 MaybeObject* maybe_result = |
8980 isolate->heap()->AllocateGlobalContext(function, scope_info); | 8964 isolate->heap()->AllocateGlobalContext(function, scope_info); |
8981 if (!maybe_result->To(&result)) return maybe_result; | 8965 if (!maybe_result->To(&result)) return maybe_result; |
8982 | 8966 |
8983 ASSERT(function->context() == isolate->context()); | 8967 ASSERT(function->context() == isolate->context()); |
8984 ASSERT(function->context()->global_object() == result->global_object()); | 8968 ASSERT(function->context()->global_object() == result->global_object()); |
8985 result->global_object()->set_global_context(result); | 8969 result->global_object()->set_global_context(result); |
8986 | 8970 |
8987 return result; // non-failure | 8971 return result; // non-failure |
8988 } | 8972 } |
8989 | 8973 |
8990 | 8974 |
8991 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewFunctionContext) { | 8975 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewFunctionContext) { |
8992 SealHandleScope shs(isolate); | 8976 SealHandleScope shs(isolate); |
8993 ASSERT(args.length() == 1); | 8977 ASSERT(args.length() == 1); |
8994 | 8978 |
8995 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 8979 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
8996 int length = function->shared()->scope_info()->ContextLength(); | 8980 int length = function->shared()->scope_info()->ContextLength(); |
8997 return isolate->heap()->AllocateFunctionContext(length, function); | 8981 return isolate->heap()->AllocateFunctionContext(length, function); |
8998 } | 8982 } |
8999 | 8983 |
9000 | 8984 |
9001 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushWithContext) { | 8985 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_PushWithContext) { |
9002 SealHandleScope shs(isolate); | 8986 SealHandleScope shs(isolate); |
9003 ASSERT(args.length() == 2); | 8987 ASSERT(args.length() == 2); |
9004 JSReceiver* extension_object; | 8988 JSReceiver* extension_object; |
9005 if (args[0]->IsJSReceiver()) { | 8989 if (args[0]->IsJSReceiver()) { |
9006 extension_object = JSReceiver::cast(args[0]); | 8990 extension_object = JSReceiver::cast(args[0]); |
9007 } else { | 8991 } else { |
9008 // Convert the object to a proper JavaScript object. | 8992 // Convert the object to a proper JavaScript object. |
9009 MaybeObject* maybe_js_object = args[0]->ToObject(isolate); | 8993 MaybeObject* maybe_js_object = args[0]->ToObject(isolate); |
9010 if (!maybe_js_object->To(&extension_object)) { | 8994 if (!maybe_js_object->To(&extension_object)) { |
9011 if (Failure::cast(maybe_js_object)->IsInternalError()) { | 8995 if (Failure::cast(maybe_js_object)->IsInternalError()) { |
(...skipping 23 matching lines...) Expand all Loading... |
9035 MaybeObject* maybe_context = | 9019 MaybeObject* maybe_context = |
9036 isolate->heap()->AllocateWithContext(function, | 9020 isolate->heap()->AllocateWithContext(function, |
9037 isolate->context(), | 9021 isolate->context(), |
9038 extension_object); | 9022 extension_object); |
9039 if (!maybe_context->To(&context)) return maybe_context; | 9023 if (!maybe_context->To(&context)) return maybe_context; |
9040 isolate->set_context(context); | 9024 isolate->set_context(context); |
9041 return context; | 9025 return context; |
9042 } | 9026 } |
9043 | 9027 |
9044 | 9028 |
9045 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushCatchContext) { | 9029 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_PushCatchContext) { |
9046 SealHandleScope shs(isolate); | 9030 SealHandleScope shs(isolate); |
9047 ASSERT(args.length() == 3); | 9031 ASSERT(args.length() == 3); |
9048 String* name = String::cast(args[0]); | 9032 String* name = String::cast(args[0]); |
9049 Object* thrown_object = args[1]; | 9033 Object* thrown_object = args[1]; |
9050 JSFunction* function; | 9034 JSFunction* function; |
9051 if (args[2]->IsSmi()) { | 9035 if (args[2]->IsSmi()) { |
9052 // A smi sentinel indicates a context nested inside global code rather | 9036 // A smi sentinel indicates a context nested inside global code rather |
9053 // than some function. There is a canonical empty function that can be | 9037 // than some function. There is a canonical empty function that can be |
9054 // gotten from the native context. | 9038 // gotten from the native context. |
9055 function = isolate->context()->native_context()->closure(); | 9039 function = isolate->context()->native_context()->closure(); |
9056 } else { | 9040 } else { |
9057 function = JSFunction::cast(args[2]); | 9041 function = JSFunction::cast(args[2]); |
9058 } | 9042 } |
9059 Context* context; | 9043 Context* context; |
9060 MaybeObject* maybe_context = | 9044 MaybeObject* maybe_context = |
9061 isolate->heap()->AllocateCatchContext(function, | 9045 isolate->heap()->AllocateCatchContext(function, |
9062 isolate->context(), | 9046 isolate->context(), |
9063 name, | 9047 name, |
9064 thrown_object); | 9048 thrown_object); |
9065 if (!maybe_context->To(&context)) return maybe_context; | 9049 if (!maybe_context->To(&context)) return maybe_context; |
9066 isolate->set_context(context); | 9050 isolate->set_context(context); |
9067 return context; | 9051 return context; |
9068 } | 9052 } |
9069 | 9053 |
9070 | 9054 |
9071 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushBlockContext) { | 9055 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_PushBlockContext) { |
9072 SealHandleScope shs(isolate); | 9056 SealHandleScope shs(isolate); |
9073 ASSERT(args.length() == 2); | 9057 ASSERT(args.length() == 2); |
9074 ScopeInfo* scope_info = ScopeInfo::cast(args[0]); | 9058 ScopeInfo* scope_info = ScopeInfo::cast(args[0]); |
9075 JSFunction* function; | 9059 JSFunction* function; |
9076 if (args[1]->IsSmi()) { | 9060 if (args[1]->IsSmi()) { |
9077 // A smi sentinel indicates a context nested inside global code rather | 9061 // A smi sentinel indicates a context nested inside global code rather |
9078 // than some function. There is a canonical empty function that can be | 9062 // than some function. There is a canonical empty function that can be |
9079 // gotten from the native context. | 9063 // gotten from the native context. |
9080 function = isolate->context()->native_context()->closure(); | 9064 function = isolate->context()->native_context()->closure(); |
9081 } else { | 9065 } else { |
(...skipping 11 matching lines...) Expand all Loading... |
9093 | 9077 |
9094 | 9078 |
9095 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsJSModule) { | 9079 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsJSModule) { |
9096 SealHandleScope shs(isolate); | 9080 SealHandleScope shs(isolate); |
9097 ASSERT(args.length() == 1); | 9081 ASSERT(args.length() == 1); |
9098 Object* obj = args[0]; | 9082 Object* obj = args[0]; |
9099 return isolate->heap()->ToBoolean(obj->IsJSModule()); | 9083 return isolate->heap()->ToBoolean(obj->IsJSModule()); |
9100 } | 9084 } |
9101 | 9085 |
9102 | 9086 |
9103 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushModuleContext) { | 9087 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_PushModuleContext) { |
9104 SealHandleScope shs(isolate); | 9088 SealHandleScope shs(isolate); |
9105 ASSERT(args.length() == 2); | 9089 ASSERT(args.length() == 2); |
9106 CONVERT_SMI_ARG_CHECKED(index, 0); | 9090 CONVERT_SMI_ARG_CHECKED(index, 0); |
9107 | 9091 |
9108 if (!args[1]->IsScopeInfo()) { | 9092 if (!args[1]->IsScopeInfo()) { |
9109 // Module already initialized. Find hosting context and retrieve context. | 9093 // Module already initialized. Find hosting context and retrieve context. |
9110 Context* host = Context::cast(isolate->context())->global_context(); | 9094 Context* host = Context::cast(isolate->context())->global_context(); |
9111 Context* context = Context::cast(host->get(index)); | 9095 Context* context = Context::cast(host->get(index)); |
9112 ASSERT(context->previous() == isolate->context()); | 9096 ASSERT(context->previous() == isolate->context()); |
9113 isolate->set_context(context); | 9097 isolate->set_context(context); |
(...skipping 14 matching lines...) Expand all Loading... |
9128 context->set_global_object(previous->global_object()); | 9112 context->set_global_object(previous->global_object()); |
9129 isolate->set_context(*context); | 9113 isolate->set_context(*context); |
9130 | 9114 |
9131 // Find hosting scope and initialize internal variable holding module there. | 9115 // Find hosting scope and initialize internal variable holding module there. |
9132 previous->global_context()->set(index, *context); | 9116 previous->global_context()->set(index, *context); |
9133 | 9117 |
9134 return *context; | 9118 return *context; |
9135 } | 9119 } |
9136 | 9120 |
9137 | 9121 |
9138 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareModules) { | 9122 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_DeclareModules) { |
9139 HandleScope scope(isolate); | 9123 HandleScope scope(isolate); |
9140 ASSERT(args.length() == 1); | 9124 ASSERT(args.length() == 1); |
9141 CONVERT_ARG_HANDLE_CHECKED(FixedArray, descriptions, 0); | 9125 CONVERT_ARG_HANDLE_CHECKED(FixedArray, descriptions, 0); |
9142 Context* host_context = isolate->context(); | 9126 Context* host_context = isolate->context(); |
9143 | 9127 |
9144 for (int i = 0; i < descriptions->length(); ++i) { | 9128 for (int i = 0; i < descriptions->length(); ++i) { |
9145 Handle<ModuleInfo> description(ModuleInfo::cast(descriptions->get(i))); | 9129 Handle<ModuleInfo> description(ModuleInfo::cast(descriptions->get(i))); |
9146 int host_index = description->host_index(); | 9130 int host_index = description->host_index(); |
9147 Handle<Context> context(Context::cast(host_context->get(host_index))); | 9131 Handle<Context> context(Context::cast(host_context->get(host_index))); |
9148 Handle<JSModule> module(context->module()); | 9132 Handle<JSModule> module(context->module()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9181 } | 9165 } |
9182 | 9166 |
9183 JSObject::PreventExtensions(module); | 9167 JSObject::PreventExtensions(module); |
9184 } | 9168 } |
9185 | 9169 |
9186 ASSERT(!isolate->has_pending_exception()); | 9170 ASSERT(!isolate->has_pending_exception()); |
9187 return isolate->heap()->undefined_value(); | 9171 return isolate->heap()->undefined_value(); |
9188 } | 9172 } |
9189 | 9173 |
9190 | 9174 |
9191 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteContextSlot) { | 9175 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_DeleteContextSlot) { |
9192 HandleScope scope(isolate); | 9176 HandleScope scope(isolate); |
9193 ASSERT(args.length() == 2); | 9177 ASSERT(args.length() == 2); |
9194 | 9178 |
9195 CONVERT_ARG_HANDLE_CHECKED(Context, context, 0); | 9179 CONVERT_ARG_HANDLE_CHECKED(Context, context, 0); |
9196 CONVERT_ARG_HANDLE_CHECKED(String, name, 1); | 9180 CONVERT_ARG_HANDLE_CHECKED(String, name, 1); |
9197 | 9181 |
9198 int index; | 9182 int index; |
9199 PropertyAttributes attributes; | 9183 PropertyAttributes attributes; |
9200 ContextLookupFlags flags = FOLLOW_CHAINS; | 9184 ContextLookupFlags flags = FOLLOW_CHAINS; |
9201 BindingFlags binding_flags; | 9185 BindingFlags binding_flags; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9367 HandleVector(&name, 1)); | 9351 HandleVector(&name, 1)); |
9368 return MakePair(isolate->Throw(*reference_error), NULL); | 9352 return MakePair(isolate->Throw(*reference_error), NULL); |
9369 } else { | 9353 } else { |
9370 // The property doesn't exist - return undefined. | 9354 // The property doesn't exist - return undefined. |
9371 return MakePair(isolate->heap()->undefined_value(), | 9355 return MakePair(isolate->heap()->undefined_value(), |
9372 isolate->heap()->undefined_value()); | 9356 isolate->heap()->undefined_value()); |
9373 } | 9357 } |
9374 } | 9358 } |
9375 | 9359 |
9376 | 9360 |
9377 RUNTIME_FUNCTION(ObjectPair, Runtime_LoadContextSlot) { | 9361 RUNTIME_FUNCTION(ObjectPair, RuntimeHidden_LoadContextSlot) { |
9378 return LoadContextSlotHelper(args, isolate, true); | 9362 return LoadContextSlotHelper(args, isolate, true); |
9379 } | 9363 } |
9380 | 9364 |
9381 | 9365 |
9382 RUNTIME_FUNCTION(ObjectPair, Runtime_LoadContextSlotNoReferenceError) { | 9366 RUNTIME_FUNCTION(ObjectPair, RuntimeHidden_LoadContextSlotNoReferenceError) { |
9383 return LoadContextSlotHelper(args, isolate, false); | 9367 return LoadContextSlotHelper(args, isolate, false); |
9384 } | 9368 } |
9385 | 9369 |
9386 | 9370 |
9387 RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreContextSlot) { | 9371 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_StoreContextSlot) { |
9388 HandleScope scope(isolate); | 9372 HandleScope scope(isolate); |
9389 ASSERT(args.length() == 4); | 9373 ASSERT(args.length() == 4); |
9390 | 9374 |
9391 Handle<Object> value(args[0], isolate); | 9375 Handle<Object> value(args[0], isolate); |
9392 CONVERT_ARG_HANDLE_CHECKED(Context, context, 1); | 9376 CONVERT_ARG_HANDLE_CHECKED(Context, context, 1); |
9393 CONVERT_ARG_HANDLE_CHECKED(String, name, 2); | 9377 CONVERT_ARG_HANDLE_CHECKED(String, name, 2); |
9394 CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode, 3); | 9378 CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode, 3); |
9395 | 9379 |
9396 int index; | 9380 int index; |
9397 PropertyAttributes attributes; | 9381 PropertyAttributes attributes; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9462 // Setting read only property in strict mode. | 9446 // Setting read only property in strict mode. |
9463 Handle<Object> error = | 9447 Handle<Object> error = |
9464 isolate->factory()->NewTypeError( | 9448 isolate->factory()->NewTypeError( |
9465 "strict_cannot_assign", HandleVector(&name, 1)); | 9449 "strict_cannot_assign", HandleVector(&name, 1)); |
9466 return isolate->Throw(*error); | 9450 return isolate->Throw(*error); |
9467 } | 9451 } |
9468 return *value; | 9452 return *value; |
9469 } | 9453 } |
9470 | 9454 |
9471 | 9455 |
9472 RUNTIME_FUNCTION(MaybeObject*, Runtime_Throw) { | 9456 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_Throw) { |
9473 HandleScope scope(isolate); | 9457 HandleScope scope(isolate); |
9474 ASSERT(args.length() == 1); | 9458 ASSERT(args.length() == 1); |
9475 | 9459 |
9476 return isolate->Throw(args[0]); | 9460 return isolate->Throw(args[0]); |
9477 } | 9461 } |
9478 | 9462 |
9479 | 9463 |
9480 RUNTIME_FUNCTION(MaybeObject*, Runtime_ReThrow) { | 9464 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_ReThrow) { |
9481 HandleScope scope(isolate); | 9465 HandleScope scope(isolate); |
9482 ASSERT(args.length() == 1); | 9466 ASSERT(args.length() == 1); |
9483 | 9467 |
9484 return isolate->ReThrow(args[0]); | 9468 return isolate->ReThrow(args[0]); |
9485 } | 9469 } |
9486 | 9470 |
9487 | 9471 |
9488 RUNTIME_FUNCTION(MaybeObject*, Runtime_PromoteScheduledException) { | 9472 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_PromoteScheduledException) { |
9489 SealHandleScope shs(isolate); | 9473 SealHandleScope shs(isolate); |
9490 ASSERT_EQ(0, args.length()); | 9474 ASSERT_EQ(0, args.length()); |
9491 return isolate->PromoteScheduledException(); | 9475 return isolate->PromoteScheduledException(); |
9492 } | 9476 } |
9493 | 9477 |
9494 | 9478 |
9495 RUNTIME_FUNCTION(MaybeObject*, Runtime_ThrowReferenceError) { | 9479 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_ThrowReferenceError) { |
9496 HandleScope scope(isolate); | 9480 HandleScope scope(isolate); |
9497 ASSERT(args.length() == 1); | 9481 ASSERT(args.length() == 1); |
9498 | 9482 |
9499 Handle<Object> name(args[0], isolate); | 9483 Handle<Object> name(args[0], isolate); |
9500 Handle<Object> reference_error = | 9484 Handle<Object> reference_error = |
9501 isolate->factory()->NewReferenceError("not_defined", | 9485 isolate->factory()->NewReferenceError("not_defined", |
9502 HandleVector(&name, 1)); | 9486 HandleVector(&name, 1)); |
9503 return isolate->Throw(*reference_error); | 9487 return isolate->Throw(*reference_error); |
9504 } | 9488 } |
9505 | 9489 |
9506 | 9490 |
9507 RUNTIME_FUNCTION(MaybeObject*, Runtime_ThrowNotDateError) { | 9491 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_ThrowNotDateError) { |
9508 HandleScope scope(isolate); | 9492 HandleScope scope(isolate); |
9509 ASSERT(args.length() == 0); | 9493 ASSERT(args.length() == 0); |
9510 return isolate->Throw(*isolate->factory()->NewTypeError( | 9494 return isolate->Throw(*isolate->factory()->NewTypeError( |
9511 "not_date_object", HandleVector<Object>(NULL, 0))); | 9495 "not_date_object", HandleVector<Object>(NULL, 0))); |
9512 } | 9496 } |
9513 | 9497 |
9514 | 9498 |
9515 RUNTIME_FUNCTION(MaybeObject*, Runtime_ThrowMessage) { | 9499 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_ThrowMessage) { |
9516 HandleScope scope(isolate); | 9500 HandleScope scope(isolate); |
9517 ASSERT(args.length() == 1); | 9501 ASSERT(args.length() == 1); |
9518 CONVERT_SMI_ARG_CHECKED(message_id, 0); | 9502 CONVERT_SMI_ARG_CHECKED(message_id, 0); |
9519 const char* message = GetBailoutReason( | 9503 const char* message = GetBailoutReason( |
9520 static_cast<BailoutReason>(message_id)); | 9504 static_cast<BailoutReason>(message_id)); |
9521 Handle<String> message_handle = | 9505 Handle<String> message_handle = |
9522 isolate->factory()->NewStringFromAscii(CStrVector(message)); | 9506 isolate->factory()->NewStringFromAscii(CStrVector(message)); |
9523 RETURN_IF_EMPTY_HANDLE(isolate, message_handle); | 9507 RETURN_IF_EMPTY_HANDLE(isolate, message_handle); |
9524 return isolate->Throw(*message_handle); | 9508 return isolate->Throw(*message_handle); |
9525 } | 9509 } |
9526 | 9510 |
9527 | 9511 |
9528 RUNTIME_FUNCTION(MaybeObject*, Runtime_StackGuard) { | 9512 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_StackGuard) { |
9529 SealHandleScope shs(isolate); | 9513 SealHandleScope shs(isolate); |
9530 ASSERT(args.length() == 0); | 9514 ASSERT(args.length() == 0); |
9531 | 9515 |
9532 // First check if this is a real stack overflow. | 9516 // First check if this is a real stack overflow. |
9533 if (isolate->stack_guard()->IsStackOverflow()) { | 9517 if (isolate->stack_guard()->IsStackOverflow()) { |
9534 return isolate->StackOverflow(); | 9518 return isolate->StackOverflow(); |
9535 } | 9519 } |
9536 | 9520 |
9537 return Execution::HandleStackGuardInterrupt(isolate); | 9521 return Execution::HandleStackGuardInterrupt(isolate); |
9538 } | 9522 } |
9539 | 9523 |
9540 | 9524 |
9541 RUNTIME_FUNCTION(MaybeObject*, Runtime_TryInstallOptimizedCode) { | 9525 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_TryInstallOptimizedCode) { |
9542 HandleScope scope(isolate); | 9526 HandleScope scope(isolate); |
9543 ASSERT(args.length() == 1); | 9527 ASSERT(args.length() == 1); |
9544 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 9528 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
9545 | 9529 |
9546 // First check if this is a real stack overflow. | 9530 // First check if this is a real stack overflow. |
9547 if (isolate->stack_guard()->IsStackOverflow()) { | 9531 if (isolate->stack_guard()->IsStackOverflow()) { |
9548 SealHandleScope shs(isolate); | 9532 SealHandleScope shs(isolate); |
9549 return isolate->StackOverflow(); | 9533 return isolate->StackOverflow(); |
9550 } | 9534 } |
9551 | 9535 |
9552 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); | 9536 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); |
9553 return (function->IsOptimized()) ? function->code() | 9537 return (function->IsOptimized()) ? function->code() |
9554 : function->shared()->code(); | 9538 : function->shared()->code(); |
9555 } | 9539 } |
9556 | 9540 |
9557 | 9541 |
9558 RUNTIME_FUNCTION(MaybeObject*, Runtime_Interrupt) { | 9542 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_Interrupt) { |
9559 SealHandleScope shs(isolate); | 9543 SealHandleScope shs(isolate); |
9560 ASSERT(args.length() == 0); | 9544 ASSERT(args.length() == 0); |
9561 return Execution::HandleStackGuardInterrupt(isolate); | 9545 return Execution::HandleStackGuardInterrupt(isolate); |
9562 } | 9546 } |
9563 | 9547 |
9564 | 9548 |
9565 static int StackSize(Isolate* isolate) { | 9549 static int StackSize(Isolate* isolate) { |
9566 int n = 0; | 9550 int n = 0; |
9567 for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) n++; | 9551 for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) n++; |
9568 return n; | 9552 return n; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9848 // and return the compiled function bound in the local context. | 9832 // and return the compiled function bound in the local context. |
9849 static const ParseRestriction restriction = NO_PARSE_RESTRICTION; | 9833 static const ParseRestriction restriction = NO_PARSE_RESTRICTION; |
9850 Handle<JSFunction> compiled = Compiler::GetFunctionFromEval( | 9834 Handle<JSFunction> compiled = Compiler::GetFunctionFromEval( |
9851 source, context, strict_mode, restriction, scope_position); | 9835 source, context, strict_mode, restriction, scope_position); |
9852 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, compiled, | 9836 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, compiled, |
9853 MakePair(Failure::Exception(), NULL)); | 9837 MakePair(Failure::Exception(), NULL)); |
9854 return MakePair(*compiled, *receiver); | 9838 return MakePair(*compiled, *receiver); |
9855 } | 9839 } |
9856 | 9840 |
9857 | 9841 |
9858 RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEval) { | 9842 RUNTIME_FUNCTION(ObjectPair, RuntimeHidden_ResolvePossiblyDirectEval) { |
9859 HandleScope scope(isolate); | 9843 HandleScope scope(isolate); |
9860 ASSERT(args.length() == 5); | 9844 ASSERT(args.length() == 5); |
9861 | 9845 |
9862 Handle<Object> callee = args.at<Object>(0); | 9846 Handle<Object> callee = args.at<Object>(0); |
9863 | 9847 |
9864 // If "eval" didn't refer to the original GlobalEval, it's not a | 9848 // If "eval" didn't refer to the original GlobalEval, it's not a |
9865 // direct call to eval. | 9849 // direct call to eval. |
9866 // (And even if it is, but the first argument isn't a string, just let | 9850 // (And even if it is, but the first argument isn't a string, just let |
9867 // execution default to an indirect call to eval, which will also return | 9851 // execution default to an indirect call to eval, which will also return |
9868 // the first argument without doing anything). | 9852 // the first argument without doing anything). |
(...skipping 30 matching lines...) Expand all Loading... |
9899 } | 9883 } |
9900 #ifdef DEBUG | 9884 #ifdef DEBUG |
9901 MemoryChunk* chunk = MemoryChunk::FromAddress(allocation->address()); | 9885 MemoryChunk* chunk = MemoryChunk::FromAddress(allocation->address()); |
9902 ASSERT(chunk->owner()->identity() == space); | 9886 ASSERT(chunk->owner()->identity() == space); |
9903 #endif | 9887 #endif |
9904 heap->CreateFillerObjectAt(allocation->address(), size); | 9888 heap->CreateFillerObjectAt(allocation->address(), size); |
9905 return allocation; | 9889 return allocation; |
9906 } | 9890 } |
9907 | 9891 |
9908 | 9892 |
9909 RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateInNewSpace) { | 9893 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_AllocateInNewSpace) { |
9910 SealHandleScope shs(isolate); | 9894 SealHandleScope shs(isolate); |
9911 ASSERT(args.length() == 1); | 9895 ASSERT(args.length() == 1); |
9912 CONVERT_SMI_ARG_CHECKED(size, 0); | 9896 CONVERT_SMI_ARG_CHECKED(size, 0); |
9913 return Allocate(isolate, size, false, NEW_SPACE); | 9897 return Allocate(isolate, size, false, NEW_SPACE); |
9914 } | 9898 } |
9915 | 9899 |
9916 | 9900 |
9917 RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateInTargetSpace) { | 9901 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_AllocateInTargetSpace) { |
9918 SealHandleScope shs(isolate); | 9902 SealHandleScope shs(isolate); |
9919 ASSERT(args.length() == 2); | 9903 ASSERT(args.length() == 2); |
9920 CONVERT_SMI_ARG_CHECKED(size, 0); | 9904 CONVERT_SMI_ARG_CHECKED(size, 0); |
9921 CONVERT_SMI_ARG_CHECKED(flags, 1); | 9905 CONVERT_SMI_ARG_CHECKED(flags, 1); |
9922 bool double_align = AllocateDoubleAlignFlag::decode(flags); | 9906 bool double_align = AllocateDoubleAlignFlag::decode(flags); |
9923 AllocationSpace space = AllocateTargetSpace::decode(flags); | 9907 AllocationSpace space = AllocateTargetSpace::decode(flags); |
9924 return Allocate(isolate, size, double_align, space); | 9908 return Allocate(isolate, size, double_align, space); |
9925 } | 9909 } |
9926 | 9910 |
9927 | 9911 |
(...skipping 5026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14954 !can_use_type_feedback)) { | 14938 !can_use_type_feedback)) { |
14955 // The arguments passed in caused a transition. This kind of complexity | 14939 // The arguments passed in caused a transition. This kind of complexity |
14956 // can't be dealt with in the inlined hydrogen array constructor case. | 14940 // can't be dealt with in the inlined hydrogen array constructor case. |
14957 // We must mark the allocationsite as un-inlinable. | 14941 // We must mark the allocationsite as un-inlinable. |
14958 site->SetDoNotInlineCall(); | 14942 site->SetDoNotInlineCall(); |
14959 } | 14943 } |
14960 return *array; | 14944 return *array; |
14961 } | 14945 } |
14962 | 14946 |
14963 | 14947 |
14964 RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayConstructor) { | 14948 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_ArrayConstructor) { |
14965 HandleScope scope(isolate); | 14949 HandleScope scope(isolate); |
14966 // If we get 2 arguments then they are the stub parameters (constructor, type | 14950 // If we get 2 arguments then they are the stub parameters (constructor, type |
14967 // info). If we get 4, then the first one is a pointer to the arguments | 14951 // info). If we get 4, then the first one is a pointer to the arguments |
14968 // passed by the caller, and the last one is the length of the arguments | 14952 // passed by the caller, and the last one is the length of the arguments |
14969 // passed to the caller (redundant, but useful to check on the deoptimizer | 14953 // passed to the caller (redundant, but useful to check on the deoptimizer |
14970 // with an assert). | 14954 // with an assert). |
14971 Arguments empty_args(0, NULL); | 14955 Arguments empty_args(0, NULL); |
14972 bool no_caller_args = args.length() == 2; | 14956 bool no_caller_args = args.length() == 2; |
14973 ASSERT(no_caller_args || args.length() == 4); | 14957 ASSERT(no_caller_args || args.length() == 4); |
14974 int parameters_start = no_caller_args ? 0 : 1; | 14958 int parameters_start = no_caller_args ? 0 : 1; |
(...skipping 16 matching lines...) Expand all Loading... |
14991 ASSERT(!site->SitePointsToLiteral()); | 14975 ASSERT(!site->SitePointsToLiteral()); |
14992 } | 14976 } |
14993 | 14977 |
14994 return ArrayConstructorCommon(isolate, | 14978 return ArrayConstructorCommon(isolate, |
14995 constructor, | 14979 constructor, |
14996 site, | 14980 site, |
14997 caller_args); | 14981 caller_args); |
14998 } | 14982 } |
14999 | 14983 |
15000 | 14984 |
15001 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalArrayConstructor) { | 14985 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_InternalArrayConstructor) { |
15002 HandleScope scope(isolate); | 14986 HandleScope scope(isolate); |
15003 Arguments empty_args(0, NULL); | 14987 Arguments empty_args(0, NULL); |
15004 bool no_caller_args = args.length() == 1; | 14988 bool no_caller_args = args.length() == 1; |
15005 ASSERT(no_caller_args || args.length() == 3); | 14989 ASSERT(no_caller_args || args.length() == 3); |
15006 int parameters_start = no_caller_args ? 0 : 1; | 14990 int parameters_start = no_caller_args ? 0 : 1; |
15007 Arguments* caller_args = no_caller_args | 14991 Arguments* caller_args = no_caller_args |
15008 ? &empty_args | 14992 ? &empty_args |
15009 : reinterpret_cast<Arguments*>(args[0]); | 14993 : reinterpret_cast<Arguments*>(args[0]); |
15010 CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, parameters_start); | 14994 CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, parameters_start); |
15011 #ifdef DEBUG | 14995 #ifdef DEBUG |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15122 // Handle last resort GC and make sure to allow future allocations | 15106 // Handle last resort GC and make sure to allow future allocations |
15123 // to grow the heap without causing GCs (if possible). | 15107 // to grow the heap without causing GCs (if possible). |
15124 isolate->counters()->gc_last_resort_from_js()->Increment(); | 15108 isolate->counters()->gc_last_resort_from_js()->Increment(); |
15125 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 15109 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
15126 "Runtime::PerformGC"); | 15110 "Runtime::PerformGC"); |
15127 } | 15111 } |
15128 } | 15112 } |
15129 | 15113 |
15130 | 15114 |
15131 } } // namespace v8::internal | 15115 } } // namespace v8::internal |
OLD | NEW |