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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 bool double_align = AllocateDoubleAlignFlag::decode(flags); | 292 bool double_align = AllocateDoubleAlignFlag::decode(flags); |
293 AllocationSpace space = AllocateTargetSpace::decode(flags); | 293 AllocationSpace space = AllocateTargetSpace::decode(flags); |
294 CHECK(size <= kMaxRegularHeapObjectSize || space == LO_SPACE); | 294 CHECK(size <= kMaxRegularHeapObjectSize || space == LO_SPACE); |
295 return *isolate->factory()->NewFillerObject(size, double_align, space); | 295 return *isolate->factory()->NewFillerObject(size, double_align, space); |
296 } | 296 } |
297 | 297 |
298 RUNTIME_FUNCTION(Runtime_AllocateSeqOneByteString) { | 298 RUNTIME_FUNCTION(Runtime_AllocateSeqOneByteString) { |
299 HandleScope scope(isolate); | 299 HandleScope scope(isolate); |
300 DCHECK_EQ(1, args.length()); | 300 DCHECK_EQ(1, args.length()); |
301 CONVERT_SMI_ARG_CHECKED(length, 0); | 301 CONVERT_SMI_ARG_CHECKED(length, 0); |
| 302 if (length == 0) return isolate->heap()->empty_string(); |
302 Handle<SeqOneByteString> result; | 303 Handle<SeqOneByteString> result; |
303 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 304 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
304 isolate, result, isolate->factory()->NewRawOneByteString(length)); | 305 isolate, result, isolate->factory()->NewRawOneByteString(length)); |
305 return *result; | 306 return *result; |
306 } | 307 } |
307 | 308 |
308 RUNTIME_FUNCTION(Runtime_AllocateSeqTwoByteString) { | 309 RUNTIME_FUNCTION(Runtime_AllocateSeqTwoByteString) { |
309 HandleScope scope(isolate); | 310 HandleScope scope(isolate); |
310 DCHECK_EQ(1, args.length()); | 311 DCHECK_EQ(1, args.length()); |
311 CONVERT_SMI_ARG_CHECKED(length, 0); | 312 CONVERT_SMI_ARG_CHECKED(length, 0); |
| 313 if (length == 0) return isolate->heap()->empty_string(); |
312 Handle<SeqTwoByteString> result; | 314 Handle<SeqTwoByteString> result; |
313 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 315 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
314 isolate, result, isolate->factory()->NewRawTwoByteString(length)); | 316 isolate, result, isolate->factory()->NewRawTwoByteString(length)); |
315 return *result; | 317 return *result; |
316 } | 318 } |
317 | 319 |
318 | 320 |
319 RUNTIME_FUNCTION(Runtime_IS_VAR) { | 321 RUNTIME_FUNCTION(Runtime_IS_VAR) { |
320 UNREACHABLE(); // implemented as macro in the parser | 322 UNREACHABLE(); // implemented as macro in the parser |
321 return NULL; | 323 return NULL; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 HandleScope scope(isolate); | 493 HandleScope scope(isolate); |
492 DCHECK_EQ(1, args.length()); | 494 DCHECK_EQ(1, args.length()); |
493 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0); | 495 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0); |
494 Handle<JSObject> global_proxy(target->global_proxy(), isolate); | 496 Handle<JSObject> global_proxy(target->global_proxy(), isolate); |
495 return *isolate->factory()->ToBoolean( | 497 return *isolate->factory()->ToBoolean( |
496 Builtins::AllowDynamicFunction(isolate, target, global_proxy)); | 498 Builtins::AllowDynamicFunction(isolate, target, global_proxy)); |
497 } | 499 } |
498 | 500 |
499 } // namespace internal | 501 } // namespace internal |
500 } // namespace v8 | 502 } // namespace v8 |
OLD | NEW |