OLD | NEW |
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 13277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13288 return isolate->factory()->NewStringFromAsciiChecked(kNativeCodeSource); | 13288 return isolate->factory()->NewStringFromAsciiChecked(kNativeCodeSource); |
13289 } | 13289 } |
13290 | 13290 |
13291 | 13291 |
13292 // static | 13292 // static |
13293 Handle<String> JSFunction::ToString(Handle<JSFunction> function) { | 13293 Handle<String> JSFunction::ToString(Handle<JSFunction> function) { |
13294 Isolate* const isolate = function->GetIsolate(); | 13294 Isolate* const isolate = function->GetIsolate(); |
13295 Handle<SharedFunctionInfo> shared_info(function->shared(), isolate); | 13295 Handle<SharedFunctionInfo> shared_info(function->shared(), isolate); |
13296 | 13296 |
13297 // Check if {function} should hide its source code. | 13297 // Check if {function} should hide its source code. |
13298 if (!shared_info->IsUserJavaScript()) { | 13298 if (!shared_info->script()->IsScript() || |
| 13299 Script::cast(shared_info->script())->hide_source()) { |
13299 return NativeCodeFunctionSourceString(shared_info); | 13300 return NativeCodeFunctionSourceString(shared_info); |
13300 } | 13301 } |
13301 | 13302 |
13302 // Check if we should print {function} as a class. | 13303 // Check if we should print {function} as a class. |
13303 Handle<Object> class_start_position = JSReceiver::GetDataProperty( | 13304 Handle<Object> class_start_position = JSReceiver::GetDataProperty( |
13304 function, isolate->factory()->class_start_position_symbol()); | 13305 function, isolate->factory()->class_start_position_symbol()); |
13305 if (class_start_position->IsSmi()) { | 13306 if (class_start_position->IsSmi()) { |
13306 Handle<Object> class_end_position = JSReceiver::GetDataProperty( | 13307 Handle<Object> class_end_position = JSReceiver::GetDataProperty( |
13307 function, isolate->factory()->class_end_position_symbol()); | 13308 function, isolate->factory()->class_end_position_symbol()); |
13308 Handle<String> script_source( | 13309 Handle<String> script_source( |
(...skipping 7090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20399 // depend on this. | 20400 // depend on this. |
20400 return DICTIONARY_ELEMENTS; | 20401 return DICTIONARY_ELEMENTS; |
20401 } | 20402 } |
20402 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20403 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
20403 return kind; | 20404 return kind; |
20404 } | 20405 } |
20405 } | 20406 } |
20406 | 20407 |
20407 } // namespace internal | 20408 } // namespace internal |
20408 } // namespace v8 | 20409 } // namespace v8 |
OLD | NEW |