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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 bool double_align = AllocateDoubleAlignFlag::decode(flags); | 291 bool double_align = AllocateDoubleAlignFlag::decode(flags); |
292 AllocationSpace space = AllocateTargetSpace::decode(flags); | 292 AllocationSpace space = AllocateTargetSpace::decode(flags); |
293 CHECK(size <= kMaxRegularHeapObjectSize || space == LO_SPACE); | 293 CHECK(size <= kMaxRegularHeapObjectSize || space == LO_SPACE); |
294 return *isolate->factory()->NewFillerObject(size, double_align, space); | 294 return *isolate->factory()->NewFillerObject(size, double_align, space); |
295 } | 295 } |
296 | 296 |
297 RUNTIME_FUNCTION(Runtime_AllocateSeqOneByteString) { | 297 RUNTIME_FUNCTION(Runtime_AllocateSeqOneByteString) { |
298 HandleScope scope(isolate); | 298 HandleScope scope(isolate); |
299 DCHECK_EQ(1, args.length()); | 299 DCHECK_EQ(1, args.length()); |
300 CONVERT_SMI_ARG_CHECKED(length, 0); | 300 CONVERT_SMI_ARG_CHECKED(length, 0); |
301 if (length == 0) return isolate->heap()->empty_string(); | |
302 Handle<SeqOneByteString> result; | 301 Handle<SeqOneByteString> result; |
303 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 302 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
304 isolate, result, isolate->factory()->NewRawOneByteString(length)); | 303 isolate, result, isolate->factory()->NewRawOneByteString(length)); |
305 return *result; | 304 return *result; |
306 } | 305 } |
307 | 306 |
308 RUNTIME_FUNCTION(Runtime_AllocateSeqTwoByteString) { | 307 RUNTIME_FUNCTION(Runtime_AllocateSeqTwoByteString) { |
309 HandleScope scope(isolate); | 308 HandleScope scope(isolate); |
310 DCHECK_EQ(1, args.length()); | 309 DCHECK_EQ(1, args.length()); |
311 CONVERT_SMI_ARG_CHECKED(length, 0); | 310 CONVERT_SMI_ARG_CHECKED(length, 0); |
312 if (length == 0) return isolate->heap()->empty_string(); | |
313 Handle<SeqTwoByteString> result; | 311 Handle<SeqTwoByteString> result; |
314 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 312 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
315 isolate, result, isolate->factory()->NewRawTwoByteString(length)); | 313 isolate, result, isolate->factory()->NewRawTwoByteString(length)); |
316 return *result; | 314 return *result; |
317 } | 315 } |
318 | 316 |
319 | 317 |
320 RUNTIME_FUNCTION(Runtime_IS_VAR) { | 318 RUNTIME_FUNCTION(Runtime_IS_VAR) { |
321 UNREACHABLE(); // implemented as macro in the parser | 319 UNREACHABLE(); // implemented as macro in the parser |
322 return NULL; | 320 return NULL; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 487 |
490 RUNTIME_FUNCTION(Runtime_Typeof) { | 488 RUNTIME_FUNCTION(Runtime_Typeof) { |
491 HandleScope scope(isolate); | 489 HandleScope scope(isolate); |
492 DCHECK_EQ(1, args.length()); | 490 DCHECK_EQ(1, args.length()); |
493 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 491 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
494 return *Object::TypeOf(isolate, object); | 492 return *Object::TypeOf(isolate, object); |
495 } | 493 } |
496 | 494 |
497 } // namespace internal | 495 } // namespace internal |
498 } // namespace v8 | 496 } // namespace v8 |
OLD | NEW |