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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; | 459 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; |
460 | 460 |
461 // Check if boilerplate exists. If not, create it first. | 461 // Check if boilerplate exists. If not, create it first. |
462 Handle<Object> boilerplate(literals->get(literals_index), isolate); | 462 Handle<Object> boilerplate(literals->get(literals_index), isolate); |
463 if (*boilerplate == isolate->heap()->undefined_value()) { | 463 if (*boilerplate == isolate->heap()->undefined_value()) { |
464 boilerplate = CreateObjectLiteralBoilerplate(isolate, | 464 boilerplate = CreateObjectLiteralBoilerplate(isolate, |
465 literals, | 465 literals, |
466 constant_properties, | 466 constant_properties, |
467 should_have_fast_elements, | 467 should_have_fast_elements, |
468 has_function_literal); | 468 has_function_literal); |
469 if (boilerplate.is_null()) return Failure::Exception(); | 469 RETURN_IF_EMPTY_HANDLE(isolate, boilerplate); |
470 // Update the functions literal and return the boilerplate. | 470 // Update the functions literal and return the boilerplate. |
471 literals->set(literals_index, *boilerplate); | 471 literals->set(literals_index, *boilerplate); |
472 } | 472 } |
473 return JSObject::cast(*boilerplate)->DeepCopy(isolate); | 473 return JSObject::cast(*boilerplate)->DeepCopy(isolate); |
474 } | 474 } |
475 | 475 |
476 | 476 |
477 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) { | 477 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) { |
478 HandleScope scope(isolate); | 478 HandleScope scope(isolate); |
479 ASSERT(args.length() == 4); | 479 ASSERT(args.length() == 4); |
480 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 480 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
481 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 481 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
482 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); | 482 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); |
483 CONVERT_SMI_ARG_CHECKED(flags, 3); | 483 CONVERT_SMI_ARG_CHECKED(flags, 3); |
484 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; | 484 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; |
485 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; | 485 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; |
486 | 486 |
487 // Check if boilerplate exists. If not, create it first. | 487 // Check if boilerplate exists. If not, create it first. |
488 Handle<Object> boilerplate(literals->get(literals_index), isolate); | 488 Handle<Object> boilerplate(literals->get(literals_index), isolate); |
489 if (*boilerplate == isolate->heap()->undefined_value()) { | 489 if (*boilerplate == isolate->heap()->undefined_value()) { |
490 boilerplate = CreateObjectLiteralBoilerplate(isolate, | 490 boilerplate = CreateObjectLiteralBoilerplate(isolate, |
491 literals, | 491 literals, |
492 constant_properties, | 492 constant_properties, |
493 should_have_fast_elements, | 493 should_have_fast_elements, |
494 has_function_literal); | 494 has_function_literal); |
495 if (boilerplate.is_null()) return Failure::Exception(); | 495 RETURN_IF_EMPTY_HANDLE(isolate, boilerplate); |
496 // Update the functions literal and return the boilerplate. | 496 // Update the functions literal and return the boilerplate. |
497 literals->set(literals_index, *boilerplate); | 497 literals->set(literals_index, *boilerplate); |
498 } | 498 } |
499 return isolate->heap()->CopyJSObject(JSObject::cast(*boilerplate)); | 499 return isolate->heap()->CopyJSObject(JSObject::cast(*boilerplate)); |
500 } | 500 } |
501 | 501 |
502 | 502 |
503 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) { | 503 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) { |
504 HandleScope scope(isolate); | 504 HandleScope scope(isolate); |
505 ASSERT(args.length() == 3); | 505 ASSERT(args.length() == 3); |
506 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 506 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
507 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 507 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
508 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); | 508 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); |
509 | 509 |
510 // Check if boilerplate exists. If not, create it first. | 510 // Check if boilerplate exists. If not, create it first. |
511 Handle<Object> boilerplate(literals->get(literals_index), isolate); | 511 Handle<Object> boilerplate(literals->get(literals_index), isolate); |
512 if (*boilerplate == isolate->heap()->undefined_value()) { | 512 if (*boilerplate == isolate->heap()->undefined_value()) { |
513 ASSERT(*elements != isolate->heap()->empty_fixed_array()); | 513 ASSERT(*elements != isolate->heap()->empty_fixed_array()); |
514 boilerplate = | 514 boilerplate = |
515 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); | 515 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); |
516 if (boilerplate.is_null()) return Failure::Exception(); | 516 RETURN_IF_EMPTY_HANDLE(isolate, boilerplate); |
517 // Update the functions literal and return the boilerplate. | 517 // Update the functions literal and return the boilerplate. |
518 literals->set(literals_index, *boilerplate); | 518 literals->set(literals_index, *boilerplate); |
519 } | 519 } |
520 return JSObject::cast(*boilerplate)->DeepCopy(isolate); | 520 return JSObject::cast(*boilerplate)->DeepCopy(isolate); |
521 } | 521 } |
522 | 522 |
523 | 523 |
524 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) { | 524 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) { |
525 HandleScope scope(isolate); | 525 HandleScope scope(isolate); |
526 ASSERT(args.length() == 3); | 526 ASSERT(args.length() == 3); |
527 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 527 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
528 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 528 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
529 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); | 529 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); |
530 | 530 |
531 // Check if boilerplate exists. If not, create it first. | 531 // Check if boilerplate exists. If not, create it first. |
532 Handle<Object> boilerplate(literals->get(literals_index), isolate); | 532 Handle<Object> boilerplate(literals->get(literals_index), isolate); |
533 if (*boilerplate == isolate->heap()->undefined_value()) { | 533 if (*boilerplate == isolate->heap()->undefined_value()) { |
534 ASSERT(*elements != isolate->heap()->empty_fixed_array()); | 534 ASSERT(*elements != isolate->heap()->empty_fixed_array()); |
535 boilerplate = | 535 boilerplate = |
536 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); | 536 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); |
537 if (boilerplate.is_null()) return Failure::Exception(); | 537 RETURN_IF_EMPTY_HANDLE(isolate, boilerplate); |
538 // Update the functions literal and return the boilerplate. | 538 // Update the functions literal and return the boilerplate. |
539 literals->set(literals_index, *boilerplate); | 539 literals->set(literals_index, *boilerplate); |
540 } | 540 } |
541 if (JSObject::cast(*boilerplate)->elements()->map() == | 541 if (JSObject::cast(*boilerplate)->elements()->map() == |
542 isolate->heap()->fixed_cow_array_map()) { | 542 isolate->heap()->fixed_cow_array_map()) { |
543 isolate->counters()->cow_arrays_created_runtime()->Increment(); | 543 isolate->counters()->cow_arrays_created_runtime()->Increment(); |
544 } | 544 } |
545 | 545 |
546 JSObject* boilerplate_object = JSObject::cast(*boilerplate); | 546 JSObject* boilerplate_object = JSObject::cast(*boilerplate); |
547 AllocationSiteMode mode = AllocationSiteInfo::GetMode( | 547 AllocationSiteMode mode = AllocationSiteInfo::GetMode( |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { | 1452 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { |
1453 HandleScope scope(isolate); | 1453 HandleScope scope(isolate); |
1454 ASSERT(args.length() == 2); | 1454 ASSERT(args.length() == 2); |
1455 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 1455 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
1456 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); | 1456 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
1457 if (FLAG_harmony_observation && obj->map()->is_observed()) { | 1457 if (FLAG_harmony_observation && obj->map()->is_observed()) { |
1458 Handle<Object> old_value( | 1458 Handle<Object> old_value( |
1459 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); | 1459 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); |
1460 | 1460 |
1461 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); | 1461 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); |
1462 if (result.is_null()) return Failure::Exception(); | 1462 RETURN_IF_EMPTY_HANDLE(isolate, result); |
1463 | 1463 |
1464 Handle<Object> new_value( | 1464 Handle<Object> new_value( |
1465 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); | 1465 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); |
1466 if (!new_value->SameValue(*old_value)) { | 1466 if (!new_value->SameValue(*old_value)) { |
1467 JSObject::EnqueueChangeRecord(obj, "prototype", | 1467 JSObject::EnqueueChangeRecord(obj, "prototype", |
1468 isolate->factory()->proto_string(), | 1468 isolate->factory()->proto_string(), |
1469 old_value); | 1469 old_value); |
1470 } | 1470 } |
1471 return *result; | 1471 return *result; |
1472 } | 1472 } |
1473 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); | 1473 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); |
1474 if (result.is_null()) return Failure::Exception(); | 1474 RETURN_IF_EMPTY_HANDLE(isolate, result); |
1475 return *result; | 1475 return *result; |
1476 } | 1476 } |
1477 | 1477 |
1478 | 1478 |
1479 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInPrototypeChain) { | 1479 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInPrototypeChain) { |
1480 SealHandleScope shs(isolate); | 1480 SealHandleScope shs(isolate); |
1481 ASSERT(args.length() == 2); | 1481 ASSERT(args.length() == 2); |
1482 // See ECMA-262, section 15.3.5.3, page 88 (steps 5 - 8). | 1482 // See ECMA-262, section 15.3.5.3, page 88 (steps 5 - 8). |
1483 Object* O = args[0]; | 1483 Object* O = args[0]; |
1484 Object* V = args[1]; | 1484 Object* V = args[1]; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1627 | 1627 |
1628 Handle<FixedArray> elms = isolate->factory()->NewFixedArray(DESCRIPTOR_SIZE); | 1628 Handle<FixedArray> elms = isolate->factory()->NewFixedArray(DESCRIPTOR_SIZE); |
1629 elms->set(ENUMERABLE_INDEX, heap->ToBoolean((attrs & DONT_ENUM) == 0)); | 1629 elms->set(ENUMERABLE_INDEX, heap->ToBoolean((attrs & DONT_ENUM) == 0)); |
1630 elms->set(CONFIGURABLE_INDEX, heap->ToBoolean((attrs & DONT_DELETE) == 0)); | 1630 elms->set(CONFIGURABLE_INDEX, heap->ToBoolean((attrs & DONT_DELETE) == 0)); |
1631 elms->set(IS_ACCESSOR_INDEX, heap->ToBoolean(raw_accessors != NULL)); | 1631 elms->set(IS_ACCESSOR_INDEX, heap->ToBoolean(raw_accessors != NULL)); |
1632 | 1632 |
1633 if (raw_accessors == NULL) { | 1633 if (raw_accessors == NULL) { |
1634 elms->set(WRITABLE_INDEX, heap->ToBoolean((attrs & READ_ONLY) == 0)); | 1634 elms->set(WRITABLE_INDEX, heap->ToBoolean((attrs & READ_ONLY) == 0)); |
1635 // GetProperty does access check. | 1635 // GetProperty does access check. |
1636 Handle<Object> value = GetProperty(isolate, obj, name); | 1636 Handle<Object> value = GetProperty(isolate, obj, name); |
1637 if (value.is_null()) return Failure::Exception(); | 1637 RETURN_IF_EMPTY_HANDLE(isolate, value); |
1638 elms->set(VALUE_INDEX, *value); | 1638 elms->set(VALUE_INDEX, *value); |
1639 } else { | 1639 } else { |
1640 // Access checks are performed for both accessors separately. | 1640 // Access checks are performed for both accessors separately. |
1641 // When they fail, the respective field is not set in the descriptor. | 1641 // When they fail, the respective field is not set in the descriptor. |
1642 Object* getter = accessors->GetComponent(ACCESSOR_GETTER); | 1642 Object* getter = accessors->GetComponent(ACCESSOR_GETTER); |
1643 Object* setter = accessors->GetComponent(ACCESSOR_SETTER); | 1643 Object* setter = accessors->GetComponent(ACCESSOR_SETTER); |
1644 if (!getter->IsMap() && CheckPropertyAccess(*obj, *name, v8::ACCESS_GET)) { | 1644 if (!getter->IsMap() && CheckPropertyAccess(*obj, *name, v8::ACCESS_GET)) { |
1645 elms->set(GETTER_INDEX, getter); | 1645 elms->set(GETTER_INDEX, getter); |
1646 } | 1646 } |
1647 if (!setter->IsMap() && CheckPropertyAccess(*obj, *name, v8::ACCESS_SET)) { | 1647 if (!setter->IsMap() && CheckPropertyAccess(*obj, *name, v8::ACCESS_SET)) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 | 1692 |
1693 | 1693 |
1694 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpCompile) { | 1694 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpCompile) { |
1695 HandleScope scope(isolate); | 1695 HandleScope scope(isolate); |
1696 ASSERT(args.length() == 3); | 1696 ASSERT(args.length() == 3); |
1697 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, re, 0); | 1697 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, re, 0); |
1698 CONVERT_ARG_HANDLE_CHECKED(String, pattern, 1); | 1698 CONVERT_ARG_HANDLE_CHECKED(String, pattern, 1); |
1699 CONVERT_ARG_HANDLE_CHECKED(String, flags, 2); | 1699 CONVERT_ARG_HANDLE_CHECKED(String, flags, 2); |
1700 Handle<Object> result = | 1700 Handle<Object> result = |
1701 RegExpImpl::Compile(re, pattern, flags); | 1701 RegExpImpl::Compile(re, pattern, flags); |
1702 if (result.is_null()) return Failure::Exception(); | 1702 RETURN_IF_EMPTY_HANDLE(isolate, result); |
1703 return *result; | 1703 return *result; |
1704 } | 1704 } |
1705 | 1705 |
1706 | 1706 |
1707 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateApiFunction) { | 1707 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateApiFunction) { |
1708 HandleScope scope(isolate); | 1708 HandleScope scope(isolate); |
1709 ASSERT(args.length() == 1); | 1709 ASSERT(args.length() == 1); |
1710 CONVERT_ARG_HANDLE_CHECKED(FunctionTemplateInfo, data, 0); | 1710 CONVERT_ARG_HANDLE_CHECKED(FunctionTemplateInfo, data, 0); |
1711 return *isolate->factory()->CreateApiFunction(data); | 1711 return *isolate->factory()->CreateApiFunction(data); |
1712 } | 1712 } |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2242 // length of a string, i.e. it is always a Smi. We check anyway for security. | 2242 // length of a string, i.e. it is always a Smi. We check anyway for security. |
2243 CONVERT_SMI_ARG_CHECKED(index, 2); | 2243 CONVERT_SMI_ARG_CHECKED(index, 2); |
2244 CONVERT_ARG_HANDLE_CHECKED(JSArray, last_match_info, 3); | 2244 CONVERT_ARG_HANDLE_CHECKED(JSArray, last_match_info, 3); |
2245 RUNTIME_ASSERT(index >= 0); | 2245 RUNTIME_ASSERT(index >= 0); |
2246 RUNTIME_ASSERT(index <= subject->length()); | 2246 RUNTIME_ASSERT(index <= subject->length()); |
2247 isolate->counters()->regexp_entry_runtime()->Increment(); | 2247 isolate->counters()->regexp_entry_runtime()->Increment(); |
2248 Handle<Object> result = RegExpImpl::Exec(regexp, | 2248 Handle<Object> result = RegExpImpl::Exec(regexp, |
2249 subject, | 2249 subject, |
2250 index, | 2250 index, |
2251 last_match_info); | 2251 last_match_info); |
2252 if (result.is_null()) return Failure::Exception(); | 2252 RETURN_IF_EMPTY_HANDLE(isolate, result); |
2253 return *result; | 2253 return *result; |
2254 } | 2254 } |
2255 | 2255 |
2256 | 2256 |
2257 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpConstructResult) { | 2257 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpConstructResult) { |
2258 SealHandleScope shs(isolate); | 2258 SealHandleScope shs(isolate); |
2259 ASSERT(args.length() == 3); | 2259 ASSERT(args.length() == 3); |
2260 CONVERT_SMI_ARG_CHECKED(elements_count, 0); | 2260 CONVERT_SMI_ARG_CHECKED(elements_count, 0); |
2261 if (elements_count < 0 || | 2261 if (elements_count < 0 || |
2262 elements_count > FixedArray::kMaxLength || | 2262 elements_count > FixedArray::kMaxLength || |
(...skipping 7106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9369 context->ErrorMessageForCodeGenerationFromStrings(); | 9369 context->ErrorMessageForCodeGenerationFromStrings(); |
9370 return isolate->Throw(*isolate->factory()->NewEvalError( | 9370 return isolate->Throw(*isolate->factory()->NewEvalError( |
9371 "code_gen_from_strings", HandleVector<Object>(&error_message, 1))); | 9371 "code_gen_from_strings", HandleVector<Object>(&error_message, 1))); |
9372 } | 9372 } |
9373 | 9373 |
9374 // Compile source string in the native context. | 9374 // Compile source string in the native context. |
9375 ParseRestriction restriction = function_literal_only | 9375 ParseRestriction restriction = function_literal_only |
9376 ? ONLY_SINGLE_FUNCTION_LITERAL : NO_PARSE_RESTRICTION; | 9376 ? ONLY_SINGLE_FUNCTION_LITERAL : NO_PARSE_RESTRICTION; |
9377 Handle<SharedFunctionInfo> shared = Compiler::CompileEval( | 9377 Handle<SharedFunctionInfo> shared = Compiler::CompileEval( |
9378 source, context, true, CLASSIC_MODE, restriction, RelocInfo::kNoPosition); | 9378 source, context, true, CLASSIC_MODE, restriction, RelocInfo::kNoPosition); |
9379 if (shared.is_null()) return Failure::Exception(); | 9379 RETURN_IF_EMPTY_HANDLE(isolate, shared); |
9380 Handle<JSFunction> fun = | 9380 Handle<JSFunction> fun = |
9381 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, | 9381 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, |
9382 context, | 9382 context, |
9383 NOT_TENURED); | 9383 NOT_TENURED); |
9384 return *fun; | 9384 return *fun; |
9385 } | 9385 } |
9386 | 9386 |
9387 | 9387 |
9388 static ObjectPair CompileGlobalEval(Isolate* isolate, | 9388 static ObjectPair CompileGlobalEval(Isolate* isolate, |
9389 Handle<String> source, | 9389 Handle<String> source, |
(...skipping 16 matching lines...) Expand all Loading... |
9406 | 9406 |
9407 // Deal with a normal eval call with a string argument. Compile it | 9407 // Deal with a normal eval call with a string argument. Compile it |
9408 // and return the compiled function bound in the local context. | 9408 // and return the compiled function bound in the local context. |
9409 Handle<SharedFunctionInfo> shared = Compiler::CompileEval( | 9409 Handle<SharedFunctionInfo> shared = Compiler::CompileEval( |
9410 source, | 9410 source, |
9411 context, | 9411 context, |
9412 context->IsNativeContext(), | 9412 context->IsNativeContext(), |
9413 language_mode, | 9413 language_mode, |
9414 NO_PARSE_RESTRICTION, | 9414 NO_PARSE_RESTRICTION, |
9415 scope_position); | 9415 scope_position); |
9416 if (shared.is_null()) return MakePair(Failure::Exception(), NULL); | 9416 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, shared, |
| 9417 MakePair(Failure::Exception(), NULL)); |
9417 Handle<JSFunction> compiled = | 9418 Handle<JSFunction> compiled = |
9418 isolate->factory()->NewFunctionFromSharedFunctionInfo( | 9419 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
9419 shared, context, NOT_TENURED); | 9420 shared, context, NOT_TENURED); |
9420 return MakePair(*compiled, *receiver); | 9421 return MakePair(*compiled, *receiver); |
9421 } | 9422 } |
9422 | 9423 |
9423 | 9424 |
9424 RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEval) { | 9425 RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEval) { |
9425 HandleScope scope(isolate); | 9426 HandleScope scope(isolate); |
9426 ASSERT(args.length() == 5); | 9427 ASSERT(args.length() == 5); |
(...skipping 2979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12406 context = isolate->factory()->NewWithContext(closure, context, extension); | 12407 context = isolate->factory()->NewWithContext(closure, context, extension); |
12407 } | 12408 } |
12408 | 12409 |
12409 Handle<SharedFunctionInfo> shared = Compiler::CompileEval( | 12410 Handle<SharedFunctionInfo> shared = Compiler::CompileEval( |
12410 source, | 12411 source, |
12411 context, | 12412 context, |
12412 context->IsNativeContext(), | 12413 context->IsNativeContext(), |
12413 CLASSIC_MODE, | 12414 CLASSIC_MODE, |
12414 NO_PARSE_RESTRICTION, | 12415 NO_PARSE_RESTRICTION, |
12415 RelocInfo::kNoPosition); | 12416 RelocInfo::kNoPosition); |
12416 if (shared.is_null()) return Failure::Exception(); | 12417 RETURN_IF_EMPTY_HANDLE(isolate, shared); |
12417 | 12418 |
12418 Handle<JSFunction> eval_fun = | 12419 Handle<JSFunction> eval_fun = |
12419 isolate->factory()->NewFunctionFromSharedFunctionInfo( | 12420 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
12420 shared, context, NOT_TENURED); | 12421 shared, context, NOT_TENURED); |
12421 bool pending_exception; | 12422 bool pending_exception; |
12422 Handle<Object> result = Execution::Call( | 12423 Handle<Object> result = Execution::Call( |
12423 eval_fun, receiver, 0, NULL, &pending_exception); | 12424 eval_fun, receiver, 0, NULL, &pending_exception); |
12424 | 12425 |
12425 if (pending_exception) return Failure::Exception(); | 12426 if (pending_exception) return Failure::Exception(); |
12426 | 12427 |
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13945 // Handle last resort GC and make sure to allow future allocations | 13946 // Handle last resort GC and make sure to allow future allocations |
13946 // to grow the heap without causing GCs (if possible). | 13947 // to grow the heap without causing GCs (if possible). |
13947 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13948 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13948 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13949 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13949 "Runtime::PerformGC"); | 13950 "Runtime::PerformGC"); |
13950 } | 13951 } |
13951 } | 13952 } |
13952 | 13953 |
13953 | 13954 |
13954 } } // namespace v8::internal | 13955 } } // namespace v8::internal |
OLD | NEW |