OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 CONVERT_ARG_CHECKED(JSFunction, fun, 0); | 79 CONVERT_ARG_CHECKED(JSFunction, fun, 0); |
80 int pos = fun->shared()->start_position(); | 80 int pos = fun->shared()->start_position(); |
81 return Smi::FromInt(pos); | 81 return Smi::FromInt(pos); |
82 } | 82 } |
83 | 83 |
84 | 84 |
85 RUNTIME_FUNCTION(Runtime_FunctionGetPositionForOffset) { | 85 RUNTIME_FUNCTION(Runtime_FunctionGetPositionForOffset) { |
86 SealHandleScope shs(isolate); | 86 SealHandleScope shs(isolate); |
87 DCHECK(args.length() == 2); | 87 DCHECK(args.length() == 2); |
88 | 88 |
89 CONVERT_ARG_CHECKED(Code, code, 0); | 89 CONVERT_ARG_CHECKED(AbstractCode, abstract_code, 0); |
90 CONVERT_NUMBER_CHECKED(int, offset, Int32, args[1]); | 90 CONVERT_NUMBER_CHECKED(int, offset, Int32, args[1]); |
91 | 91 return Smi::FromInt(abstract_code->SourcePosition(offset)); |
92 RUNTIME_ASSERT(0 <= offset && offset < code->Size()); | |
93 | |
94 Address pc = code->address() + offset; | |
95 return Smi::FromInt(code->SourcePosition(pc)); | |
96 } | 92 } |
97 | 93 |
98 | 94 |
99 RUNTIME_FUNCTION(Runtime_FunctionSetInstanceClassName) { | 95 RUNTIME_FUNCTION(Runtime_FunctionSetInstanceClassName) { |
100 SealHandleScope shs(isolate); | 96 SealHandleScope shs(isolate); |
101 DCHECK(args.length() == 2); | 97 DCHECK(args.length() == 2); |
102 | 98 |
103 CONVERT_ARG_CHECKED(JSFunction, fun, 0); | 99 CONVERT_ARG_CHECKED(JSFunction, fun, 0); |
104 CONVERT_ARG_CHECKED(String, name, 1); | 100 CONVERT_ARG_CHECKED(String, name, 1); |
105 fun->shared()->set_instance_class_name(name); | 101 fun->shared()->set_instance_class_name(name); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 DCHECK_EQ(1, args.length()); | 348 DCHECK_EQ(1, args.length()); |
353 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); | 349 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); |
354 return function->IsJSBoundFunction() | 350 return function->IsJSBoundFunction() |
355 ? *JSBoundFunction::ToString( | 351 ? *JSBoundFunction::ToString( |
356 Handle<JSBoundFunction>::cast(function)) | 352 Handle<JSBoundFunction>::cast(function)) |
357 : *JSFunction::ToString(Handle<JSFunction>::cast(function)); | 353 : *JSFunction::ToString(Handle<JSFunction>::cast(function)); |
358 } | 354 } |
359 | 355 |
360 } // namespace internal | 356 } // namespace internal |
361 } // namespace v8 | 357 } // namespace v8 |
OLD | NEW |