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

Side by Side Diff: src/objects.cc

Issue 1756433002: [api] Don't go to javascript to construct API functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 9 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 <sstream> 9 #include <sstream>
10 10
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 Handle<Object> return_value = v8::Utils::OpenHandle(*result); 1074 Handle<Object> return_value = v8::Utils::OpenHandle(*result);
1075 return_value->VerifyApiCallResultType(); 1075 return_value->VerifyApiCallResultType();
1076 // Rebox handle before return. 1076 // Rebox handle before return.
1077 return handle(*return_value, isolate); 1077 return handle(*return_value, isolate);
1078 } 1078 }
1079 1079
1080 // Regular accessor. 1080 // Regular accessor.
1081 Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate); 1081 Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate);
1082 if (getter->IsFunctionTemplateInfo()) { 1082 if (getter->IsFunctionTemplateInfo()) {
1083 auto result = Builtins::InvokeApiFunction( 1083 auto result = Builtins::InvokeApiFunction(
1084 Handle<FunctionTemplateInfo>::cast(getter), receiver, 0, nullptr); 1084 false, Handle<FunctionTemplateInfo>::cast(getter), receiver, 0,
1085 nullptr);
1085 if (isolate->has_pending_exception()) { 1086 if (isolate->has_pending_exception()) {
1086 return MaybeHandle<Object>(); 1087 return MaybeHandle<Object>();
1087 } 1088 }
1088 Handle<Object> return_value; 1089 Handle<Object> return_value;
1089 if (result.ToHandle(&return_value)) { 1090 if (result.ToHandle(&return_value)) {
1090 return_value->VerifyApiCallResultType(); 1091 return_value->VerifyApiCallResultType();
1091 return handle(*return_value, isolate); 1092 return handle(*return_value, isolate);
1092 } 1093 }
1093 } else if (getter->IsCallable()) { 1094 } else if (getter->IsCallable()) {
1094 // TODO(rossberg): nicer would be to cast to some JSCallable here... 1095 // TODO(rossberg): nicer would be to cast to some JSCallable here...
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 should_throw); 1144 should_throw);
1144 args.Call(call_fun, v8::Utils::ToLocal(name), v8::Utils::ToLocal(value)); 1145 args.Call(call_fun, v8::Utils::ToLocal(name), v8::Utils::ToLocal(value));
1145 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); 1146 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
1146 return Just(true); 1147 return Just(true);
1147 } 1148 }
1148 1149
1149 // Regular accessor. 1150 // Regular accessor.
1150 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate); 1151 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate);
1151 if (setter->IsFunctionTemplateInfo()) { 1152 if (setter->IsFunctionTemplateInfo()) {
1152 Handle<Object> argv[] = {value}; 1153 Handle<Object> argv[] = {value};
1153 auto result = 1154 auto result = Builtins::InvokeApiFunction(
1154 Builtins::InvokeApiFunction(Handle<FunctionTemplateInfo>::cast(setter), 1155 false, Handle<FunctionTemplateInfo>::cast(setter), receiver,
1155 receiver, arraysize(argv), argv); 1156 arraysize(argv), argv);
1156 if (isolate->has_pending_exception()) { 1157 if (isolate->has_pending_exception()) {
1157 return Nothing<bool>(); 1158 return Nothing<bool>();
1158 } 1159 }
1159 return Just(true); 1160 return Just(true);
1160 } else if (setter->IsCallable()) { 1161 } else if (setter->IsCallable()) {
1161 // TODO(rossberg): nicer would be to cast to some JSCallable here... 1162 // TODO(rossberg): nicer would be to cast to some JSCallable here...
1162 return SetPropertyWithDefinedSetter( 1163 return SetPropertyWithDefinedSetter(
1163 receiver, Handle<JSReceiver>::cast(setter), value, should_throw); 1164 receiver, Handle<JSReceiver>::cast(setter), value, should_throw);
1164 } 1165 }
1165 1166
(...skipping 18658 matching lines...) Expand 10 before | Expand all | Expand 10 after
19824 if (cell->value() != *new_value) { 19825 if (cell->value() != *new_value) {
19825 cell->set_value(*new_value); 19826 cell->set_value(*new_value);
19826 Isolate* isolate = cell->GetIsolate(); 19827 Isolate* isolate = cell->GetIsolate();
19827 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19828 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19828 isolate, DependentCode::kPropertyCellChangedGroup); 19829 isolate, DependentCode::kPropertyCellChangedGroup);
19829 } 19830 }
19830 } 19831 }
19831 19832
19832 } // namespace internal 19833 } // namespace internal
19833 } // namespace v8 19834 } // 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