| 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 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 // No frame corresponding to the given function found. Return null. | 1089 // No frame corresponding to the given function found. Return null. |
| 1090 return isolate->factory()->null_value(); | 1090 return isolate->factory()->null_value(); |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 | 1093 |
| 1094 Handle<Object> Accessors::FunctionGetArguments(Handle<JSFunction> function) { | 1094 Handle<Object> Accessors::FunctionGetArguments(Handle<JSFunction> function) { |
| 1095 return GetFunctionArguments(function->GetIsolate(), function); | 1095 return GetFunctionArguments(function->GetIsolate(), function); |
| 1096 } | 1096 } |
| 1097 | 1097 |
| 1098 | 1098 |
| 1099 Object* Accessors::FunctionGetArguments(Isolate* isolate, | 1099 void Accessors::FunctionArgumentsGetter( |
| 1100 Object* object, | 1100 v8::Local<v8::String> name, |
| 1101 void*) { | 1101 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 1102 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
| 1102 HandleScope scope(isolate); | 1103 HandleScope scope(isolate); |
| 1103 Handle<JSFunction> function; | 1104 Handle<Object> object = Utils::OpenHandle(*info.This()); |
| 1105 MaybeHandle<JSFunction> maybe_function; |
| 1106 |
| 1104 { | 1107 { |
| 1105 DisallowHeapAllocation no_allocation; | 1108 DisallowHeapAllocation no_allocation; |
| 1106 JSFunction* holder = FindInstanceOf<JSFunction>(isolate, object); | 1109 JSFunction* function = FindInstanceOf<JSFunction>(isolate, *object); |
| 1107 if (holder == NULL) return isolate->heap()->undefined_value(); | 1110 if (function != NULL) maybe_function = Handle<JSFunction>(function); |
| 1108 function = Handle<JSFunction>(holder, isolate); | |
| 1109 } | 1111 } |
| 1110 return *GetFunctionArguments(isolate, function); | 1112 |
| 1113 Handle<JSFunction> function; |
| 1114 Handle<Object> result; |
| 1115 if (maybe_function.ToHandle(&function)) { |
| 1116 result = GetFunctionArguments(isolate, function); |
| 1117 } else { |
| 1118 result = isolate->factory()->undefined_value(); |
| 1119 } |
| 1120 info.GetReturnValue().Set(Utils::ToLocal(result)); |
| 1111 } | 1121 } |
| 1112 | 1122 |
| 1113 | 1123 |
| 1114 const AccessorDescriptor Accessors::FunctionArguments = { | 1124 void Accessors::FunctionArgumentsSetter( |
| 1115 FunctionGetArguments, | 1125 v8::Local<v8::String> name, |
| 1116 ReadOnlySetAccessor, | 1126 v8::Local<v8::Value> val, |
| 1117 0 | 1127 const v8::PropertyCallbackInfo<void>& info) { |
| 1118 }; | 1128 // Do nothing. |
| 1129 } |
| 1130 |
| 1131 |
| 1132 Handle<AccessorInfo> Accessors::FunctionArgumentsInfo( |
| 1133 Isolate* isolate, PropertyAttributes attributes) { |
| 1134 return MakeAccessor(isolate, |
| 1135 isolate->factory()->arguments_string(), |
| 1136 &FunctionArgumentsGetter, |
| 1137 &FunctionArgumentsSetter, |
| 1138 attributes); |
| 1139 } |
| 1119 | 1140 |
| 1120 | 1141 |
| 1121 // | 1142 // |
| 1122 // Accessors::FunctionCaller | 1143 // Accessors::FunctionCaller |
| 1123 // | 1144 // |
| 1124 | 1145 |
| 1125 | 1146 |
| 1126 class FrameFunctionIterator { | 1147 class FrameFunctionIterator { |
| 1127 public: | 1148 public: |
| 1128 FrameFunctionIterator(Isolate* isolate, const DisallowHeapAllocation& promise) | 1149 FrameFunctionIterator(Isolate* isolate, const DisallowHeapAllocation& promise) |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 info->set_data(Smi::FromInt(index)); | 1308 info->set_data(Smi::FromInt(index)); |
| 1288 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1309 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
| 1289 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1310 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
| 1290 info->set_getter(*getter); | 1311 info->set_getter(*getter); |
| 1291 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1312 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
| 1292 return info; | 1313 return info; |
| 1293 } | 1314 } |
| 1294 | 1315 |
| 1295 | 1316 |
| 1296 } } // namespace v8::internal | 1317 } } // namespace v8::internal |
| OLD | NEW |