OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/messages.h" | 5 #include "src/messages.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/execution.h" | 10 #include "src/execution.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 294 } |
295 | 295 |
296 if (!result.is_null()) return outer_scope.CloseAndEscape(result); | 296 if (!result.is_null()) return outer_scope.CloseAndEscape(result); |
297 return isolate_->factory()->null_value(); | 297 return isolate_->factory()->null_value(); |
298 } | 298 } |
299 | 299 |
300 namespace { | 300 namespace { |
301 | 301 |
302 Object* EvalFromFunctionName(Isolate* isolate, Handle<Script> script) { | 302 Object* EvalFromFunctionName(Isolate* isolate, Handle<Script> script) { |
303 if (script->eval_from_shared()->IsUndefined(isolate)) | 303 if (script->eval_from_shared()->IsUndefined(isolate)) |
304 return *isolate->factory()->undefined_value(); | 304 return isolate->heap()->undefined_value(); |
305 | 305 |
306 Handle<SharedFunctionInfo> shared( | 306 Handle<SharedFunctionInfo> shared( |
307 SharedFunctionInfo::cast(script->eval_from_shared())); | 307 SharedFunctionInfo::cast(script->eval_from_shared())); |
308 // Find the name of the function calling eval. | 308 // Find the name of the function calling eval. |
309 if (shared->name()->BooleanValue()) { | 309 if (shared->name()->BooleanValue()) { |
310 return shared->name(); | 310 return shared->name(); |
311 } | 311 } |
312 | 312 |
313 return shared->inferred_name(); | 313 return shared->inferred_name(); |
314 } | 314 } |
315 | 315 |
316 Object* EvalFromScript(Isolate* isolate, Handle<Script> script) { | 316 Object* EvalFromScript(Isolate* isolate, Handle<Script> script) { |
317 if (script->eval_from_shared()->IsUndefined(isolate)) | 317 if (script->eval_from_shared()->IsUndefined(isolate)) |
318 return *isolate->factory()->undefined_value(); | 318 return isolate->heap()->undefined_value(); |
319 | 319 |
320 Handle<SharedFunctionInfo> eval_from_shared( | 320 Handle<SharedFunctionInfo> eval_from_shared( |
321 SharedFunctionInfo::cast(script->eval_from_shared())); | 321 SharedFunctionInfo::cast(script->eval_from_shared())); |
322 return eval_from_shared->script()->IsScript() | 322 return eval_from_shared->script()->IsScript() |
323 ? eval_from_shared->script() | 323 ? eval_from_shared->script() |
324 : *isolate->factory()->undefined_value(); | 324 : isolate->heap()->undefined_value(); |
325 } | 325 } |
326 | 326 |
327 MaybeHandle<String> FormatEvalOrigin(Isolate* isolate, Handle<Script> script) { | 327 MaybeHandle<String> FormatEvalOrigin(Isolate* isolate, Handle<Script> script) { |
328 Handle<Object> sourceURL = Script::GetNameOrSourceURL(script); | 328 Handle<Object> sourceURL = Script::GetNameOrSourceURL(script); |
329 if (!sourceURL->IsUndefined(isolate)) { | 329 if (!sourceURL->IsUndefined(isolate)) { |
330 DCHECK(sourceURL->IsString()); | 330 DCHECK(sourceURL->IsString()); |
331 return Handle<String>::cast(sourceURL); | 331 return Handle<String>::cast(sourceURL); |
332 } | 332 } |
333 | 333 |
334 IncrementalStringBuilder builder(isolate); | 334 IncrementalStringBuilder builder(isolate); |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 DCHECK(mode != SKIP_UNTIL_SEEN); | 1180 DCHECK(mode != SKIP_UNTIL_SEEN); |
1181 | 1181 |
1182 Handle<Object> no_caller; | 1182 Handle<Object> no_caller; |
1183 Handle<String> msg = FormatMessage(isolate, template_index, arg0, arg1, arg2); | 1183 Handle<String> msg = FormatMessage(isolate, template_index, arg0, arg1, arg2); |
1184 return ErrorUtils::Construct(isolate, constructor, constructor, msg, mode, | 1184 return ErrorUtils::Construct(isolate, constructor, constructor, msg, mode, |
1185 no_caller, false); | 1185 no_caller, false); |
1186 } | 1186 } |
1187 | 1187 |
1188 } // namespace internal | 1188 } // namespace internal |
1189 } // namespace v8 | 1189 } // namespace v8 |
OLD | NEW |