OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2291 has_pending_exception = | 2291 has_pending_exception = |
2292 !factory->NewConsString(source_string, | 2292 !factory->NewConsString(source_string, |
2293 factory->LookupSingleCharacterStringFromCode( | 2293 factory->LookupSingleCharacterStringFromCode( |
2294 ',')).ToHandle(&source_string); | 2294 ',')).ToHandle(&source_string); |
2295 RETURN_ON_FAILED_EXECUTION(Function); | 2295 RETURN_ON_FAILED_EXECUTION(Function); |
2296 } | 2296 } |
2297 i::Handle<i::String> brackets; | 2297 i::Handle<i::String> brackets; |
2298 if (i::FLAG_harmony_function_tostring) { | 2298 if (i::FLAG_harmony_function_tostring) { |
2299 // Append linefeed and signal that text beyond the linefeed is not part of | 2299 // Append linefeed and signal that text beyond the linefeed is not part of |
2300 // the formal parameters. | 2300 // the formal parameters. |
2301 brackets = factory->NewStringFromStaticChars("\n) {"); | 2301 brackets = factory->NewStringFromStaticChars("\n) {\n"); |
2302 parameters_end_pos = source_string->length() + 1; | 2302 parameters_end_pos = source_string->length() + 1; |
2303 } else { | 2303 } else { |
2304 brackets = factory->NewStringFromStaticChars("){"); | 2304 brackets = factory->NewStringFromStaticChars("){"); |
2305 } | 2305 } |
2306 has_pending_exception = !factory->NewConsString(source_string, brackets) | 2306 has_pending_exception = !factory->NewConsString(source_string, brackets) |
2307 .ToHandle(&source_string); | 2307 .ToHandle(&source_string); |
2308 RETURN_ON_FAILED_EXECUTION(Function); | 2308 RETURN_ON_FAILED_EXECUTION(Function); |
2309 } else { | 2309 } else { |
2310 if (i::FLAG_harmony_function_tostring) { | 2310 if (i::FLAG_harmony_function_tostring) { |
2311 source_string = | 2311 source_string = |
2312 factory->NewStringFromStaticChars("(function anonymous(\n) {"); | 2312 factory->NewStringFromStaticChars("(function anonymous(\n) {\n"); |
2313 parameters_end_pos = source_string->length() - 3; | 2313 parameters_end_pos = source_string->length() - 4; |
2314 } else { | 2314 } else { |
2315 source_string = factory->NewStringFromStaticChars("(function(){"); | 2315 source_string = factory->NewStringFromStaticChars("(function(){"); |
2316 } | 2316 } |
2317 } | 2317 } |
2318 | 2318 |
2319 int scope_position = source_string->length(); | 2319 int scope_position = source_string->length(); |
2320 has_pending_exception = | 2320 has_pending_exception = |
2321 !factory->NewConsString(source_string, | 2321 !factory->NewConsString(source_string, |
2322 Utils::OpenHandle(*source->source_string)) | 2322 Utils::OpenHandle(*source->source_string)) |
2323 .ToHandle(&source_string); | 2323 .ToHandle(&source_string); |
(...skipping 8000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10324 Address callback_address = | 10324 Address callback_address = |
10325 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10325 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
10326 VMState<EXTERNAL> state(isolate); | 10326 VMState<EXTERNAL> state(isolate); |
10327 ExternalCallbackScope call_scope(isolate, callback_address); | 10327 ExternalCallbackScope call_scope(isolate, callback_address); |
10328 callback(info); | 10328 callback(info); |
10329 } | 10329 } |
10330 | 10330 |
10331 | 10331 |
10332 } // namespace internal | 10332 } // namespace internal |
10333 } // namespace v8 | 10333 } // namespace v8 |
OLD | NEW |