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

Side by Side Diff: src/objects.cc

Issue 2203353002: [api] Stay in C++ when constructing an API-function (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: set the receiver to the_hole for construct calls Created 4 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
« no previous file with comments | « src/execution.cc ('k') | no next file » | 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 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); 1188 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
1189 if (result.is_null()) return ReadAbsentProperty(isolate, receiver, name); 1189 if (result.is_null()) return ReadAbsentProperty(isolate, receiver, name);
1190 // Rebox handle before return. 1190 // Rebox handle before return.
1191 return handle(*result, isolate); 1191 return handle(*result, isolate);
1192 } 1192 }
1193 1193
1194 // Regular accessor. 1194 // Regular accessor.
1195 Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate); 1195 Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate);
1196 if (getter->IsFunctionTemplateInfo()) { 1196 if (getter->IsFunctionTemplateInfo()) {
1197 return Builtins::InvokeApiFunction( 1197 return Builtins::InvokeApiFunction(
1198 isolate, Handle<FunctionTemplateInfo>::cast(getter), receiver, 0, 1198 isolate, false, Handle<FunctionTemplateInfo>::cast(getter), receiver, 0,
1199 nullptr); 1199 nullptr, isolate->factory()->undefined_value());
1200 } else if (getter->IsCallable()) { 1200 } else if (getter->IsCallable()) {
1201 // TODO(rossberg): nicer would be to cast to some JSCallable here... 1201 // TODO(rossberg): nicer would be to cast to some JSCallable here...
1202 return Object::GetPropertyWithDefinedGetter( 1202 return Object::GetPropertyWithDefinedGetter(
1203 receiver, Handle<JSReceiver>::cast(getter)); 1203 receiver, Handle<JSReceiver>::cast(getter));
1204 } 1204 }
1205 // Getter is not a function. 1205 // Getter is not a function.
1206 return ReadAbsentProperty(isolate, receiver, it->GetName()); 1206 return ReadAbsentProperty(isolate, receiver, it->GetName());
1207 } 1207 }
1208 1208
1209 // static 1209 // static
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); 1271 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
1272 return Just(true); 1272 return Just(true);
1273 } 1273 }
1274 1274
1275 // Regular accessor. 1275 // Regular accessor.
1276 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate); 1276 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate);
1277 if (setter->IsFunctionTemplateInfo()) { 1277 if (setter->IsFunctionTemplateInfo()) {
1278 Handle<Object> argv[] = {value}; 1278 Handle<Object> argv[] = {value};
1279 RETURN_ON_EXCEPTION_VALUE( 1279 RETURN_ON_EXCEPTION_VALUE(
1280 isolate, Builtins::InvokeApiFunction( 1280 isolate, Builtins::InvokeApiFunction(
1281 isolate, Handle<FunctionTemplateInfo>::cast(setter), 1281 isolate, false, Handle<FunctionTemplateInfo>::cast(setter),
1282 receiver, arraysize(argv), argv), 1282 receiver, arraysize(argv), argv,
1283 isolate->factory()->undefined_value()),
1283 Nothing<bool>()); 1284 Nothing<bool>());
1284 return Just(true); 1285 return Just(true);
1285 } else if (setter->IsCallable()) { 1286 } else if (setter->IsCallable()) {
1286 // TODO(rossberg): nicer would be to cast to some JSCallable here... 1287 // TODO(rossberg): nicer would be to cast to some JSCallable here...
1287 return SetPropertyWithDefinedSetter( 1288 return SetPropertyWithDefinedSetter(
1288 receiver, Handle<JSReceiver>::cast(setter), value, should_throw); 1289 receiver, Handle<JSReceiver>::cast(setter), value, should_throw);
1289 } 1290 }
1290 1291
1291 RETURN_FAILURE(isolate, should_throw, 1292 RETURN_FAILURE(isolate, should_throw,
1292 NewTypeError(MessageTemplate::kNoSetterInCallback, 1293 NewTypeError(MessageTemplate::kNoSetterInCallback,
(...skipping 17744 matching lines...) Expand 10 before | Expand all | Expand 10 after
19037 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, 19038 for (PrototypeIterator iter(isolate, this, kStartAtReceiver,
19038 PrototypeIterator::END_AT_NULL); 19039 PrototypeIterator::END_AT_NULL);
19039 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { 19040 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) {
19040 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; 19041 if (iter.GetCurrent<Object>()->IsJSProxy()) return true;
19041 } 19042 }
19042 return false; 19043 return false;
19043 } 19044 }
19044 19045
19045 } // namespace internal 19046 } // namespace internal
19046 } // namespace v8 19047 } // namespace v8
OLDNEW
« no previous file with comments | « src/execution.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698