| 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(); | |
| 303 Handle<SeqOneByteString> result; | 302 Handle<SeqOneByteString> result; |
| 304 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 303 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 305 isolate, result, isolate->factory()->NewRawOneByteString(length)); | 304 isolate, result, isolate->factory()->NewRawOneByteString(length)); |
| 306 return *result; | 305 return *result; |
| 307 } | 306 } |
| 308 | 307 |
| 309 RUNTIME_FUNCTION(Runtime_AllocateSeqTwoByteString) { | 308 RUNTIME_FUNCTION(Runtime_AllocateSeqTwoByteString) { |
| 310 HandleScope scope(isolate); | 309 HandleScope scope(isolate); |
| 311 DCHECK_EQ(1, args.length()); | 310 DCHECK_EQ(1, args.length()); |
| 312 CONVERT_SMI_ARG_CHECKED(length, 0); | 311 CONVERT_SMI_ARG_CHECKED(length, 0); |
| 313 if (length == 0) return isolate->heap()->empty_string(); | |
| 314 Handle<SeqTwoByteString> result; | 312 Handle<SeqTwoByteString> result; |
| 315 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 313 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 316 isolate, result, isolate->factory()->NewRawTwoByteString(length)); | 314 isolate, result, isolate->factory()->NewRawTwoByteString(length)); |
| 317 return *result; | 315 return *result; |
| 318 } | 316 } |
| 319 | 317 |
| 320 | 318 |
| 321 RUNTIME_FUNCTION(Runtime_IS_VAR) { | 319 RUNTIME_FUNCTION(Runtime_IS_VAR) { |
| 322 UNREACHABLE(); // implemented as macro in the parser | 320 UNREACHABLE(); // implemented as macro in the parser |
| 323 return NULL; | 321 return NULL; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 HandleScope scope(isolate); | 497 HandleScope scope(isolate); |
| 500 DCHECK_EQ(1, args.length()); | 498 DCHECK_EQ(1, args.length()); |
| 501 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0); | 499 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0); |
| 502 Handle<JSObject> global_proxy(target->global_proxy(), isolate); | 500 Handle<JSObject> global_proxy(target->global_proxy(), isolate); |
| 503 return *isolate->factory()->ToBoolean( | 501 return *isolate->factory()->ToBoolean( |
| 504 Builtins::AllowDynamicFunction(isolate, target, global_proxy)); | 502 Builtins::AllowDynamicFunction(isolate, target, global_proxy)); |
| 505 } | 503 } |
| 506 | 504 |
| 507 } // namespace internal | 505 } // namespace internal |
| 508 } // namespace v8 | 506 } // namespace v8 |
| OLD | NEW |