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

Side by Side Diff: src/objects.cc

Issue 2770003002: Set the current context to the function's context when entering to LAP. (Closed)
Patch Set: Synced. Created 3 years, 5 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
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | src/ppc/code-stubs-ppc.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 // global proxy. 1358 // global proxy.
1359 if (receiver->IsJSGlobalObject()) { 1359 if (receiver->IsJSGlobalObject()) {
1360 receiver = handle(JSGlobalObject::cast(*receiver)->global_proxy(), isolate); 1360 receiver = handle(JSGlobalObject::cast(*receiver)->global_proxy(), isolate);
1361 } 1361 }
1362 1362
1363 // We should never get here to initialize a const with the hole value since a 1363 // We should never get here to initialize a const with the hole value since a
1364 // const declaration would conflict with the getter. 1364 // const declaration would conflict with the getter.
1365 DCHECK(!structure->IsForeign()); 1365 DCHECK(!structure->IsForeign());
1366 1366
1367 // API style callbacks. 1367 // API style callbacks.
1368 Handle<JSObject> holder = it->GetHolder<JSObject>();
1368 if (structure->IsAccessorInfo()) { 1369 if (structure->IsAccessorInfo()) {
1369 Handle<JSObject> holder = it->GetHolder<JSObject>();
1370 Handle<Name> name = it->GetName(); 1370 Handle<Name> name = it->GetName();
1371 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(structure); 1371 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(structure);
1372 if (!info->IsCompatibleReceiver(*receiver)) { 1372 if (!info->IsCompatibleReceiver(*receiver)) {
1373 THROW_NEW_ERROR(isolate, 1373 THROW_NEW_ERROR(isolate,
1374 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, 1374 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver,
1375 name, receiver), 1375 name, receiver),
1376 Object); 1376 Object);
1377 } 1377 }
1378 1378
1379 v8::AccessorNameGetterCallback call_fun = 1379 v8::AccessorNameGetterCallback call_fun =
(...skipping 22 matching lines...) Expand all
1402 } 1402 }
1403 1403
1404 // AccessorPair with 'cached' private property. 1404 // AccessorPair with 'cached' private property.
1405 if (it->TryLookupCachedProperty()) { 1405 if (it->TryLookupCachedProperty()) {
1406 return Object::GetProperty(it); 1406 return Object::GetProperty(it);
1407 } 1407 }
1408 1408
1409 // Regular accessor. 1409 // Regular accessor.
1410 Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate); 1410 Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate);
1411 if (getter->IsFunctionTemplateInfo()) { 1411 if (getter->IsFunctionTemplateInfo()) {
1412 SaveContext save(isolate);
1413 isolate->set_context(*holder->GetCreationContext());
1412 return Builtins::InvokeApiFunction( 1414 return Builtins::InvokeApiFunction(
1413 isolate, false, Handle<FunctionTemplateInfo>::cast(getter), receiver, 0, 1415 isolate, false, Handle<FunctionTemplateInfo>::cast(getter), receiver, 0,
1414 nullptr, isolate->factory()->undefined_value()); 1416 nullptr, isolate->factory()->undefined_value());
1415 } else if (getter->IsCallable()) { 1417 } else if (getter->IsCallable()) {
1416 // TODO(rossberg): nicer would be to cast to some JSCallable here... 1418 // TODO(rossberg): nicer would be to cast to some JSCallable here...
1417 return Object::GetPropertyWithDefinedGetter( 1419 return Object::GetPropertyWithDefinedGetter(
1418 receiver, Handle<JSReceiver>::cast(getter)); 1420 receiver, Handle<JSReceiver>::cast(getter));
1419 } 1421 }
1420 // Getter is not a function. 1422 // Getter is not a function.
1421 return isolate->factory()->undefined_value(); 1423 return isolate->factory()->undefined_value();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 // global proxy. 1457 // global proxy.
1456 if (receiver->IsJSGlobalObject()) { 1458 if (receiver->IsJSGlobalObject()) {
1457 receiver = handle(JSGlobalObject::cast(*receiver)->global_proxy(), isolate); 1459 receiver = handle(JSGlobalObject::cast(*receiver)->global_proxy(), isolate);
1458 } 1460 }
1459 1461
1460 // We should never get here to initialize a const with the hole value since a 1462 // We should never get here to initialize a const with the hole value since a
1461 // const declaration would conflict with the setter. 1463 // const declaration would conflict with the setter.
1462 DCHECK(!structure->IsForeign()); 1464 DCHECK(!structure->IsForeign());
1463 1465
1464 // API style callbacks. 1466 // API style callbacks.
1467 Handle<JSObject> holder = it->GetHolder<JSObject>();
1465 if (structure->IsAccessorInfo()) { 1468 if (structure->IsAccessorInfo()) {
1466 Handle<JSObject> holder = it->GetHolder<JSObject>();
1467 Handle<Name> name = it->GetName(); 1469 Handle<Name> name = it->GetName();
1468 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(structure); 1470 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(structure);
1469 if (!info->IsCompatibleReceiver(*receiver)) { 1471 if (!info->IsCompatibleReceiver(*receiver)) {
1470 isolate->Throw(*isolate->factory()->NewTypeError( 1472 isolate->Throw(*isolate->factory()->NewTypeError(
1471 MessageTemplate::kIncompatibleMethodReceiver, name, receiver)); 1473 MessageTemplate::kIncompatibleMethodReceiver, name, receiver));
1472 return Nothing<bool>(); 1474 return Nothing<bool>();
1473 } 1475 }
1474 1476
1475 // The actual type of call_fun is either v8::AccessorNameSetterCallback or 1477 // The actual type of call_fun is either v8::AccessorNameSetterCallback or
1476 // i::Accesors::AccessorNameBooleanSetterCallback, depending on whether the 1478 // i::Accesors::AccessorNameBooleanSetterCallback, depending on whether the
(...skipping 25 matching lines...) Expand all
1502 // (signalling an exception) or a boolean Oddball. 1504 // (signalling an exception) or a boolean Oddball.
1503 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); 1505 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
1504 if (result.is_null()) return Just(true); 1506 if (result.is_null()) return Just(true);
1505 DCHECK(result->BooleanValue() || should_throw == DONT_THROW); 1507 DCHECK(result->BooleanValue() || should_throw == DONT_THROW);
1506 return Just(result->BooleanValue()); 1508 return Just(result->BooleanValue());
1507 } 1509 }
1508 1510
1509 // Regular accessor. 1511 // Regular accessor.
1510 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate); 1512 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate);
1511 if (setter->IsFunctionTemplateInfo()) { 1513 if (setter->IsFunctionTemplateInfo()) {
1514 SaveContext save(isolate);
1515 isolate->set_context(*holder->GetCreationContext());
1512 Handle<Object> argv[] = {value}; 1516 Handle<Object> argv[] = {value};
1513 RETURN_ON_EXCEPTION_VALUE( 1517 RETURN_ON_EXCEPTION_VALUE(
1514 isolate, Builtins::InvokeApiFunction( 1518 isolate, Builtins::InvokeApiFunction(
1515 isolate, false, Handle<FunctionTemplateInfo>::cast(setter), 1519 isolate, false, Handle<FunctionTemplateInfo>::cast(setter),
1516 receiver, arraysize(argv), argv, 1520 receiver, arraysize(argv), argv,
1517 isolate->factory()->undefined_value()), 1521 isolate->factory()->undefined_value()),
1518 Nothing<bool>()); 1522 Nothing<bool>());
1519 return Just(true); 1523 return Just(true);
1520 } else if (setter->IsCallable()) { 1524 } else if (setter->IsCallable()) {
1521 // TODO(rossberg): nicer would be to cast to some JSCallable here... 1525 // TODO(rossberg): nicer would be to cast to some JSCallable here...
(...skipping 18667 matching lines...) Expand 10 before | Expand all | Expand 10 after
20189 // not 20193 // not
20190 // depend on this. 20194 // depend on this.
20191 return DICTIONARY_ELEMENTS; 20195 return DICTIONARY_ELEMENTS;
20192 } 20196 }
20193 DCHECK_LE(kind, LAST_ELEMENTS_KIND); 20197 DCHECK_LE(kind, LAST_ELEMENTS_KIND);
20194 return kind; 20198 return kind;
20195 } 20199 }
20196 } 20200 }
20197 } // namespace internal 20201 } // namespace internal
20198 } // namespace v8 20202 } // namespace v8
OLDNEW
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698