Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: src/runtime.cc

Issue 10832365: Rename Context::global to Context::global_object, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Michael's comments. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/profile-generator.cc ('k') | src/type-info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 Handle<Object> error = 1331 Handle<Object> error =
1332 isolate->factory()->NewTypeError("redeclaration", HandleVector(args, 2)); 1332 isolate->factory()->NewTypeError("redeclaration", HandleVector(args, 2));
1333 return isolate->Throw(*error); 1333 return isolate->Throw(*error);
1334 } 1334 }
1335 1335
1336 1336
1337 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) { 1337 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) {
1338 ASSERT(args.length() == 3); 1338 ASSERT(args.length() == 3);
1339 HandleScope scope(isolate); 1339 HandleScope scope(isolate);
1340 Handle<GlobalObject> global = Handle<GlobalObject>( 1340 Handle<GlobalObject> global = Handle<GlobalObject>(
1341 isolate->context()->global()); 1341 isolate->context()->global_object());
1342 1342
1343 Handle<Context> context = args.at<Context>(0); 1343 Handle<Context> context = args.at<Context>(0);
1344 CONVERT_ARG_HANDLE_CHECKED(FixedArray, pairs, 1); 1344 CONVERT_ARG_HANDLE_CHECKED(FixedArray, pairs, 1);
1345 CONVERT_SMI_ARG_CHECKED(flags, 2); 1345 CONVERT_SMI_ARG_CHECKED(flags, 2);
1346 1346
1347 // Traverse the name/value pairs and set the properties. 1347 // Traverse the name/value pairs and set the properties.
1348 int length = pairs->length(); 1348 int length = pairs->length();
1349 for (int i = 0; i < length; i += 2) { 1349 for (int i = 0; i < length; i += 2) {
1350 HandleScope scope(isolate); 1350 HandleScope scope(isolate);
1351 Handle<String> name(String::cast(pairs->get(i))); 1351 Handle<String> name(String::cast(pairs->get(i)));
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 // args[0] == name 1549 // args[0] == name
1550 // args[1] == language_mode 1550 // args[1] == language_mode
1551 // args[2] == value (optional) 1551 // args[2] == value (optional)
1552 1552
1553 // Determine if we need to assign to the variable if it already 1553 // Determine if we need to assign to the variable if it already
1554 // exists (based on the number of arguments). 1554 // exists (based on the number of arguments).
1555 RUNTIME_ASSERT(args.length() == 2 || args.length() == 3); 1555 RUNTIME_ASSERT(args.length() == 2 || args.length() == 3);
1556 bool assign = args.length() == 3; 1556 bool assign = args.length() == 3;
1557 1557
1558 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); 1558 CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
1559 GlobalObject* global = isolate->context()->global(); 1559 GlobalObject* global = isolate->context()->global_object();
1560 RUNTIME_ASSERT(args[1]->IsSmi()); 1560 RUNTIME_ASSERT(args[1]->IsSmi());
1561 CONVERT_LANGUAGE_MODE_ARG(language_mode, 1); 1561 CONVERT_LANGUAGE_MODE_ARG(language_mode, 1);
1562 StrictModeFlag strict_mode_flag = (language_mode == CLASSIC_MODE) 1562 StrictModeFlag strict_mode_flag = (language_mode == CLASSIC_MODE)
1563 ? kNonStrictMode : kStrictMode; 1563 ? kNonStrictMode : kStrictMode;
1564 1564
1565 // According to ECMA-262, section 12.2, page 62, the property must 1565 // According to ECMA-262, section 12.2, page 62, the property must
1566 // not be deletable. 1566 // not be deletable.
1567 PropertyAttributes attributes = DONT_DELETE; 1567 PropertyAttributes attributes = DONT_DELETE;
1568 1568
1569 // Lookup the property locally in the global object. If it isn't 1569 // Lookup the property locally in the global object. If it isn't
(...skipping 22 matching lines...) Expand all
1592 &lookup, *name, args[2], attributes, strict_mode_flag); 1592 &lookup, *name, args[2], attributes, strict_mode_flag);
1593 } else { 1593 } else {
1594 return isolate->heap()->undefined_value(); 1594 return isolate->heap()->undefined_value();
1595 } 1595 }
1596 } 1596 }
1597 } 1597 }
1598 object = raw_holder->GetPrototype(); 1598 object = raw_holder->GetPrototype();
1599 } 1599 }
1600 1600
1601 // Reload global in case the loop above performed a GC. 1601 // Reload global in case the loop above performed a GC.
1602 global = isolate->context()->global(); 1602 global = isolate->context()->global_object();
1603 if (assign) { 1603 if (assign) {
1604 return global->SetProperty(*name, args[2], attributes, strict_mode_flag); 1604 return global->SetProperty(*name, args[2], attributes, strict_mode_flag);
1605 } 1605 }
1606 return isolate->heap()->undefined_value(); 1606 return isolate->heap()->undefined_value();
1607 } 1607 }
1608 1608
1609 1609
1610 RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) { 1610 RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) {
1611 // All constants are declared with an initial value. The name 1611 // All constants are declared with an initial value. The name
1612 // of the constant is the first argument and the initial value 1612 // of the constant is the first argument and the initial value
1613 // is the second. 1613 // is the second.
1614 RUNTIME_ASSERT(args.length() == 2); 1614 RUNTIME_ASSERT(args.length() == 2);
1615 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); 1615 CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
1616 Handle<Object> value = args.at<Object>(1); 1616 Handle<Object> value = args.at<Object>(1);
1617 1617
1618 // Get the current global object from top. 1618 // Get the current global object from top.
1619 GlobalObject* global = isolate->context()->global(); 1619 GlobalObject* global = isolate->context()->global_object();
1620 1620
1621 // According to ECMA-262, section 12.2, page 62, the property must 1621 // According to ECMA-262, section 12.2, page 62, the property must
1622 // not be deletable. Since it's a const, it must be READ_ONLY too. 1622 // not be deletable. Since it's a const, it must be READ_ONLY too.
1623 PropertyAttributes attributes = 1623 PropertyAttributes attributes =
1624 static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY); 1624 static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY);
1625 1625
1626 // Lookup the property locally in the global object. If it isn't 1626 // Lookup the property locally in the global object. If it isn't
1627 // there, we add the property and take special precautions to always 1627 // there, we add the property and take special precautions to always
1628 // add it as a local property even in case of callbacks in the 1628 // add it as a local property even in case of callbacks in the
1629 // prototype chain (this rules out using SetProperty). 1629 // prototype chain (this rules out using SetProperty).
1630 // We use SetLocalPropertyIgnoreAttributes instead 1630 // We use SetLocalPropertyIgnoreAttributes instead
1631 LookupResult lookup(isolate); 1631 LookupResult lookup(isolate);
1632 global->LocalLookup(*name, &lookup); 1632 global->LocalLookup(*name, &lookup);
1633 if (!lookup.IsFound()) { 1633 if (!lookup.IsFound()) {
1634 return global->SetLocalPropertyIgnoreAttributes(*name, 1634 return global->SetLocalPropertyIgnoreAttributes(*name,
1635 *value, 1635 *value,
1636 attributes); 1636 attributes);
1637 } 1637 }
1638 1638
1639 if (!lookup.IsReadOnly()) { 1639 if (!lookup.IsReadOnly()) {
1640 // Restore global object from context (in case of GC) and continue 1640 // Restore global object from context (in case of GC) and continue
1641 // with setting the value. 1641 // with setting the value.
1642 HandleScope handle_scope(isolate); 1642 HandleScope handle_scope(isolate);
1643 Handle<GlobalObject> global(isolate->context()->global()); 1643 Handle<GlobalObject> global(isolate->context()->global_object());
1644 1644
1645 // BUG 1213575: Handle the case where we have to set a read-only 1645 // BUG 1213575: Handle the case where we have to set a read-only
1646 // property through an interceptor and only do it if it's 1646 // property through an interceptor and only do it if it's
1647 // uninitialized, e.g. the hole. Nirk... 1647 // uninitialized, e.g. the hole. Nirk...
1648 // Passing non-strict mode because the property is writable. 1648 // Passing non-strict mode because the property is writable.
1649 RETURN_IF_EMPTY_HANDLE( 1649 RETURN_IF_EMPTY_HANDLE(
1650 isolate, 1650 isolate,
1651 JSReceiver::SetProperty(global, name, value, attributes, 1651 JSReceiver::SetProperty(global, name, value, attributes,
1652 kNonStrictMode)); 1652 kNonStrictMode));
1653 return *value; 1653 return *value;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 if ((attributes & READ_ONLY) == 0 || context->get(index)->IsTheHole()) { 1707 if ((attributes & READ_ONLY) == 0 || context->get(index)->IsTheHole()) {
1708 context->set(index, *value); 1708 context->set(index, *value);
1709 } 1709 }
1710 return *value; 1710 return *value;
1711 } 1711 }
1712 1712
1713 // The property could not be found, we introduce it as a property of the 1713 // The property could not be found, we introduce it as a property of the
1714 // global object. 1714 // global object.
1715 if (attributes == ABSENT) { 1715 if (attributes == ABSENT) {
1716 Handle<JSObject> global = Handle<JSObject>( 1716 Handle<JSObject> global = Handle<JSObject>(
1717 isolate->context()->global()); 1717 isolate->context()->global_object());
1718 // Strict mode not needed (const disallowed in strict mode). 1718 // Strict mode not needed (const disallowed in strict mode).
1719 RETURN_IF_EMPTY_HANDLE( 1719 RETURN_IF_EMPTY_HANDLE(
1720 isolate, 1720 isolate,
1721 JSReceiver::SetProperty(global, name, value, NONE, kNonStrictMode)); 1721 JSReceiver::SetProperty(global, name, value, NONE, kNonStrictMode));
1722 return *value; 1722 return *value;
1723 } 1723 }
1724 1724
1725 // The property was present in some function's context extension object, 1725 // The property was present in some function's context extension object,
1726 // as a property on the subject of a with, or as a property of the global 1726 // as a property on the subject of a with, or as a property of the global
1727 // object. 1727 // object.
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 JSFunction* function = JSFunction::cast(callable); 1981 JSFunction* function = JSFunction::cast(callable);
1982 1982
1983 SharedFunctionInfo* shared = function->shared(); 1983 SharedFunctionInfo* shared = function->shared();
1984 if (shared->native() || !shared->is_classic_mode()) { 1984 if (shared->native() || !shared->is_classic_mode()) {
1985 return isolate->heap()->undefined_value(); 1985 return isolate->heap()->undefined_value();
1986 } 1986 }
1987 // Returns undefined for strict or native functions, or 1987 // Returns undefined for strict or native functions, or
1988 // the associated global receiver for "normal" functions. 1988 // the associated global receiver for "normal" functions.
1989 1989
1990 Context* native_context = 1990 Context* native_context =
1991 function->context()->global()->native_context(); 1991 function->context()->global_object()->native_context();
1992 return native_context->global()->global_receiver(); 1992 return native_context->global_object()->global_receiver();
1993 } 1993 }
1994 1994
1995 1995
1996 RUNTIME_FUNCTION(MaybeObject*, Runtime_MaterializeRegExpLiteral) { 1996 RUNTIME_FUNCTION(MaybeObject*, Runtime_MaterializeRegExpLiteral) {
1997 HandleScope scope(isolate); 1997 HandleScope scope(isolate);
1998 ASSERT(args.length() == 4); 1998 ASSERT(args.length() == 4);
1999 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 1999 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
2000 int index = args.smi_at(1); 2000 int index = args.smi_at(1);
2001 Handle<String> pattern = args.at<String>(2); 2001 Handle<String> pattern = args.at<String>(2);
2002 Handle<String> flags = args.at<String>(3); 2002 Handle<String> flags = args.at<String>(3);
(...skipping 5799 matching lines...) Expand 10 before | Expand all | Expand 10 after
7802 // called using 'new' and creates a new JSFunction object that 7802 // called using 'new' and creates a new JSFunction object that
7803 // is returned. The receiver object is only used for error 7803 // is returned. The receiver object is only used for error
7804 // reporting if an error occurs when constructing the new 7804 // reporting if an error occurs when constructing the new
7805 // JSFunction. FACTORY->NewJSObject() should not be used to 7805 // JSFunction. FACTORY->NewJSObject() should not be used to
7806 // allocate JSFunctions since it does not properly initialize 7806 // allocate JSFunctions since it does not properly initialize
7807 // the shared part of the function. Since the receiver is 7807 // the shared part of the function. Since the receiver is
7808 // ignored anyway, we use the global object as the receiver 7808 // ignored anyway, we use the global object as the receiver
7809 // instead of a new JSFunction object. This way, errors are 7809 // instead of a new JSFunction object. This way, errors are
7810 // reported the same way whether or not 'Function' is called 7810 // reported the same way whether or not 'Function' is called
7811 // using 'new'. 7811 // using 'new'.
7812 return isolate->context()->global(); 7812 return isolate->context()->global_object();
7813 } 7813 }
7814 } 7814 }
7815 7815
7816 // The function should be compiled for the optimization hints to be 7816 // The function should be compiled for the optimization hints to be
7817 // available. 7817 // available.
7818 JSFunction::EnsureCompiled(function, CLEAR_EXCEPTION); 7818 JSFunction::EnsureCompiled(function, CLEAR_EXCEPTION);
7819 7819
7820 Handle<SharedFunctionInfo> shared(function->shared(), isolate); 7820 Handle<SharedFunctionInfo> shared(function->shared(), isolate);
7821 if (!function->has_initial_map() && 7821 if (!function->has_initial_map() &&
7822 shared->IsInobjectSlackTrackingInProgress()) { 7822 shared->IsInobjectSlackTrackingInProgress()) {
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
8490 NoHandleAllocation ha; 8490 NoHandleAllocation ha;
8491 ASSERT(args.length() == 1); 8491 ASSERT(args.length() == 1);
8492 CONVERT_ARG_HANDLE_CHECKED(JSModule, instance, 0); 8492 CONVERT_ARG_HANDLE_CHECKED(JSModule, instance, 0);
8493 8493
8494 Context* context = Context::cast(instance->context()); 8494 Context* context = Context::cast(instance->context());
8495 Context* previous = isolate->context(); 8495 Context* previous = isolate->context();
8496 ASSERT(context->IsModuleContext()); 8496 ASSERT(context->IsModuleContext());
8497 // Initialize the context links. 8497 // Initialize the context links.
8498 context->set_previous(previous); 8498 context->set_previous(previous);
8499 context->set_closure(previous->closure()); 8499 context->set_closure(previous->closure());
8500 context->set_global(previous->global()); 8500 context->set_global_object(previous->global_object());
8501 isolate->set_context(context); 8501 isolate->set_context(context);
8502 8502
8503 return context; 8503 return context;
8504 } 8504 }
8505 8505
8506 8506
8507 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteContextSlot) { 8507 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteContextSlot) {
8508 HandleScope scope(isolate); 8508 HandleScope scope(isolate);
8509 ASSERT(args.length() == 2); 8509 ASSERT(args.length() == 2);
8510 8510
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
8755 8755
8756 if (strict_mode == kStrictMode) { 8756 if (strict_mode == kStrictMode) {
8757 // Throw in strict mode (assignment to undefined variable). 8757 // Throw in strict mode (assignment to undefined variable).
8758 Handle<Object> error = 8758 Handle<Object> error =
8759 isolate->factory()->NewReferenceError( 8759 isolate->factory()->NewReferenceError(
8760 "not_defined", HandleVector(&name, 1)); 8760 "not_defined", HandleVector(&name, 1));
8761 return isolate->Throw(*error); 8761 return isolate->Throw(*error);
8762 } 8762 }
8763 // In non-strict mode, the property is added to the global object. 8763 // In non-strict mode, the property is added to the global object.
8764 attributes = NONE; 8764 attributes = NONE;
8765 object = Handle<JSObject>(isolate->context()->global()); 8765 object = Handle<JSObject>(isolate->context()->global_object());
8766 } 8766 }
8767 8767
8768 // Set the property if it's not read only or doesn't yet exist. 8768 // Set the property if it's not read only or doesn't yet exist.
8769 if ((attributes & READ_ONLY) == 0 || 8769 if ((attributes & READ_ONLY) == 0 ||
8770 (object->GetLocalPropertyAttribute(*name) == ABSENT)) { 8770 (object->GetLocalPropertyAttribute(*name) == ABSENT)) {
8771 RETURN_IF_EMPTY_HANDLE( 8771 RETURN_IF_EMPTY_HANDLE(
8772 isolate, 8772 isolate,
8773 JSReceiver::SetProperty(object, name, value, NONE, strict_mode)); 8773 JSReceiver::SetProperty(object, name, value, NONE, strict_mode));
8774 } else if (strict_mode == kStrictMode && (attributes & READ_ONLY) != 0) { 8774 } else if (strict_mode == kStrictMode && (attributes & READ_ONLY) != 0) {
8775 // Setting read only property in strict mode. 8775 // Setting read only property in strict mode.
(...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after
10959 return ScopeTypeCatch; 10959 return ScopeTypeCatch;
10960 case BLOCK_SCOPE: 10960 case BLOCK_SCOPE:
10961 ASSERT(!scope_info->HasContext() || 10961 ASSERT(!scope_info->HasContext() ||
10962 context_->IsBlockContext()); 10962 context_->IsBlockContext());
10963 return ScopeTypeBlock; 10963 return ScopeTypeBlock;
10964 case EVAL_SCOPE: 10964 case EVAL_SCOPE:
10965 UNREACHABLE(); 10965 UNREACHABLE();
10966 } 10966 }
10967 } 10967 }
10968 if (context_->IsNativeContext()) { 10968 if (context_->IsNativeContext()) {
10969 ASSERT(context_->global()->IsGlobalObject()); 10969 ASSERT(context_->global_object()->IsGlobalObject());
10970 return ScopeTypeGlobal; 10970 return ScopeTypeGlobal;
10971 } 10971 }
10972 if (context_->IsFunctionContext()) { 10972 if (context_->IsFunctionContext()) {
10973 return ScopeTypeClosure; 10973 return ScopeTypeClosure;
10974 } 10974 }
10975 if (context_->IsCatchContext()) { 10975 if (context_->IsCatchContext()) {
10976 return ScopeTypeCatch; 10976 return ScopeTypeCatch;
10977 } 10977 }
10978 if (context_->IsBlockContext()) { 10978 if (context_->IsBlockContext()) {
10979 return ScopeTypeBlock; 10979 return ScopeTypeBlock;
10980 } 10980 }
10981 if (context_->IsModuleContext()) { 10981 if (context_->IsModuleContext()) {
10982 return ScopeTypeModule; 10982 return ScopeTypeModule;
10983 } 10983 }
10984 ASSERT(context_->IsWithContext()); 10984 ASSERT(context_->IsWithContext());
10985 return ScopeTypeWith; 10985 return ScopeTypeWith;
10986 } 10986 }
10987 10987
10988 // Return the JavaScript object with the content of the current scope. 10988 // Return the JavaScript object with the content of the current scope.
10989 Handle<JSObject> ScopeObject() { 10989 Handle<JSObject> ScopeObject() {
10990 switch (Type()) { 10990 switch (Type()) {
10991 case ScopeIterator::ScopeTypeGlobal: 10991 case ScopeIterator::ScopeTypeGlobal:
10992 return Handle<JSObject>(CurrentContext()->global()); 10992 return Handle<JSObject>(CurrentContext()->global_object());
10993 case ScopeIterator::ScopeTypeLocal: 10993 case ScopeIterator::ScopeTypeLocal:
10994 // Materialize the content of the local scope into a JSObject. 10994 // Materialize the content of the local scope into a JSObject.
10995 ASSERT(nested_scope_chain_.length() == 1); 10995 ASSERT(nested_scope_chain_.length() == 1);
10996 return MaterializeLocalScope(isolate_, frame_, inlined_jsframe_index_); 10996 return MaterializeLocalScope(isolate_, frame_, inlined_jsframe_index_);
10997 case ScopeIterator::ScopeTypeWith: 10997 case ScopeIterator::ScopeTypeWith:
10998 // Return the with object. 10998 // Return the with object.
10999 return Handle<JSObject>(JSObject::cast(CurrentContext()->extension())); 10999 return Handle<JSObject>(JSObject::cast(CurrentContext()->extension()));
11000 case ScopeIterator::ScopeTypeCatch: 11000 case ScopeIterator::ScopeTypeCatch:
11001 return MaterializeCatchScope(isolate_, CurrentContext()); 11001 return MaterializeCatchScope(isolate_, CurrentContext());
11002 case ScopeIterator::ScopeTypeClosure: 11002 case ScopeIterator::ScopeTypeClosure:
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
11951 CLASSIC_MODE, 11951 CLASSIC_MODE,
11952 RelocInfo::kNoPosition); 11952 RelocInfo::kNoPosition);
11953 if (shared.is_null()) return Failure::Exception(); 11953 if (shared.is_null()) return Failure::Exception();
11954 Handle<JSFunction> compiled_function = 11954 Handle<JSFunction> compiled_function =
11955 Handle<JSFunction>( 11955 Handle<JSFunction>(
11956 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, 11956 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared,
11957 context)); 11957 context));
11958 11958
11959 // Invoke the result of the compilation to get the evaluation function. 11959 // Invoke the result of the compilation to get the evaluation function.
11960 bool has_pending_exception; 11960 bool has_pending_exception;
11961 Handle<Object> receiver = isolate->global(); 11961 Handle<Object> receiver = isolate->global_object();
11962 Handle<Object> result = 11962 Handle<Object> result =
11963 Execution::Call(compiled_function, receiver, 0, NULL, 11963 Execution::Call(compiled_function, receiver, 0, NULL,
11964 &has_pending_exception); 11964 &has_pending_exception);
11965 // Clear the oneshot breakpoints so that the debugger does not step further. 11965 // Clear the oneshot breakpoints so that the debugger does not step further.
11966 isolate->debug()->ClearStepping(); 11966 isolate->debug()->ClearStepping();
11967 if (has_pending_exception) return Failure::Exception(); 11967 if (has_pending_exception) return Failure::Exception();
11968 return *result; 11968 return *result;
11969 } 11969 }
11970 11970
11971 11971
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
12586 RUNTIME_FUNCTION(MaybeObject*, Runtime_ExecuteInDebugContext) { 12586 RUNTIME_FUNCTION(MaybeObject*, Runtime_ExecuteInDebugContext) {
12587 ASSERT(args.length() == 2); 12587 ASSERT(args.length() == 2);
12588 HandleScope scope(isolate); 12588 HandleScope scope(isolate);
12589 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 12589 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
12590 CONVERT_BOOLEAN_ARG_CHECKED(without_debugger, 1); 12590 CONVERT_BOOLEAN_ARG_CHECKED(without_debugger, 1);
12591 12591
12592 Handle<Object> result; 12592 Handle<Object> result;
12593 bool pending_exception; 12593 bool pending_exception;
12594 { 12594 {
12595 if (without_debugger) { 12595 if (without_debugger) {
12596 result = Execution::Call(function, isolate->global(), 0, NULL, 12596 result = Execution::Call(function, isolate->global_object(), 0, NULL,
12597 &pending_exception); 12597 &pending_exception);
12598 } else { 12598 } else {
12599 EnterDebugger enter_debugger; 12599 EnterDebugger enter_debugger;
12600 result = Execution::Call(function, isolate->global(), 0, NULL, 12600 result = Execution::Call(function, isolate->global_object(), 0, NULL,
12601 &pending_exception); 12601 &pending_exception);
12602 } 12602 }
12603 } 12603 }
12604 if (!pending_exception) { 12604 if (!pending_exception) {
12605 return *result; 12605 return *result;
12606 } else { 12606 } else {
12607 return Failure::Exception(); 12607 return Failure::Exception();
12608 } 12608 }
12609 } 12609 }
12610 12610
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
13069 // There is no value in the cache. Invoke the function and cache result. 13069 // There is no value in the cache. Invoke the function and cache result.
13070 HandleScope scope(isolate); 13070 HandleScope scope(isolate);
13071 13071
13072 Handle<JSFunctionResultCache> cache_handle(cache); 13072 Handle<JSFunctionResultCache> cache_handle(cache);
13073 Handle<Object> key_handle(key); 13073 Handle<Object> key_handle(key);
13074 Handle<Object> value; 13074 Handle<Object> value;
13075 { 13075 {
13076 Handle<JSFunction> factory(JSFunction::cast( 13076 Handle<JSFunction> factory(JSFunction::cast(
13077 cache_handle->get(JSFunctionResultCache::kFactoryIndex))); 13077 cache_handle->get(JSFunctionResultCache::kFactoryIndex)));
13078 // TODO(antonm): consider passing a receiver when constructing a cache. 13078 // TODO(antonm): consider passing a receiver when constructing a cache.
13079 Handle<Object> receiver(isolate->native_context()->global()); 13079 Handle<Object> receiver(isolate->native_context()->global_object());
13080 // This handle is nor shared, nor used later, so it's safe. 13080 // This handle is nor shared, nor used later, so it's safe.
13081 Handle<Object> argv[] = { key_handle }; 13081 Handle<Object> argv[] = { key_handle };
13082 bool pending_exception; 13082 bool pending_exception;
13083 value = Execution::Call(factory, 13083 value = Execution::Call(factory,
13084 receiver, 13084 receiver,
13085 ARRAY_SIZE(argv), 13085 ARRAY_SIZE(argv),
13086 argv, 13086 argv,
13087 &pending_exception); 13087 &pending_exception);
13088 if (pending_exception) return Failure::Exception(); 13088 if (pending_exception) return Failure::Exception();
13089 } 13089 }
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
13347 // Handle last resort GC and make sure to allow future allocations 13347 // Handle last resort GC and make sure to allow future allocations
13348 // to grow the heap without causing GCs (if possible). 13348 // to grow the heap without causing GCs (if possible).
13349 isolate->counters()->gc_last_resort_from_js()->Increment(); 13349 isolate->counters()->gc_last_resort_from_js()->Increment();
13350 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13350 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13351 "Runtime::PerformGC"); 13351 "Runtime::PerformGC");
13352 } 13352 }
13353 } 13353 }
13354 13354
13355 13355
13356 } } // namespace v8::internal 13356 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/profile-generator.cc ('k') | src/type-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698