| 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" |
| 11 #include "src/bootstrapper.h" | 11 #include "src/bootstrapper.h" |
| 12 #include "src/conversions.h" | 12 #include "src/conversions.h" |
| 13 #include "src/debug/debug.h" | 13 #include "src/debug/debug.h" |
| 14 #include "src/frames-inl.h" | 14 #include "src/frames-inl.h" |
| 15 #include "src/isolate-inl.h" | 15 #include "src/isolate-inl.h" |
| 16 #include "src/messages.h" | 16 #include "src/messages.h" |
| 17 #include "src/parsing/parse-info.h" | 17 #include "src/parsing/parse-info.h" |
| 18 #include "src/parsing/parsing.h" | 18 #include "src/parsing/parsing.h" |
| 19 #include "src/wasm/wasm-module.h" | 19 #include "src/wasm/wasm-module.h" |
| 20 | 20 |
| 21 namespace v8 { | 21 namespace v8 { |
| 22 namespace internal { | 22 namespace internal { |
| 23 | 23 |
| 24 RUNTIME_FUNCTION(Runtime_CheckIsBootstrapping) { | 24 RUNTIME_FUNCTION(Runtime_CheckIsBootstrapping) { |
| 25 SealHandleScope shs(isolate); | 25 SealHandleScope shs(isolate); |
| 26 DCHECK(args.length() == 0); | 26 DCHECK_EQ(0, args.length()); |
| 27 CHECK(isolate->bootstrapper()->IsActive()); | 27 CHECK(isolate->bootstrapper()->IsActive()); |
| 28 return isolate->heap()->undefined_value(); | 28 return isolate->heap()->undefined_value(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 | 31 |
| 32 RUNTIME_FUNCTION(Runtime_ExportFromRuntime) { | 32 RUNTIME_FUNCTION(Runtime_ExportFromRuntime) { |
| 33 HandleScope scope(isolate); | 33 HandleScope scope(isolate); |
| 34 DCHECK(args.length() == 1); | 34 DCHECK_EQ(1, args.length()); |
| 35 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0); | 35 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0); |
| 36 CHECK(isolate->bootstrapper()->IsActive()); | 36 CHECK(isolate->bootstrapper()->IsActive()); |
| 37 JSObject::NormalizeProperties(container, KEEP_INOBJECT_PROPERTIES, 10, | 37 JSObject::NormalizeProperties(container, KEEP_INOBJECT_PROPERTIES, 10, |
| 38 "ExportFromRuntime"); | 38 "ExportFromRuntime"); |
| 39 Bootstrapper::ExportFromRuntime(isolate, container); | 39 Bootstrapper::ExportFromRuntime(isolate, container); |
| 40 JSObject::MigrateSlowToFast(container, 0, "ExportFromRuntime"); | 40 JSObject::MigrateSlowToFast(container, 0, "ExportFromRuntime"); |
| 41 return *container; | 41 return *container; |
| 42 } | 42 } |
| 43 | 43 |
| 44 | 44 |
| 45 RUNTIME_FUNCTION(Runtime_ExportExperimentalFromRuntime) { | 45 RUNTIME_FUNCTION(Runtime_ExportExperimentalFromRuntime) { |
| 46 HandleScope scope(isolate); | 46 HandleScope scope(isolate); |
| 47 DCHECK(args.length() == 1); | 47 DCHECK_EQ(1, args.length()); |
| 48 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0); | 48 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0); |
| 49 CHECK(isolate->bootstrapper()->IsActive()); | 49 CHECK(isolate->bootstrapper()->IsActive()); |
| 50 JSObject::NormalizeProperties(container, KEEP_INOBJECT_PROPERTIES, 10, | 50 JSObject::NormalizeProperties(container, KEEP_INOBJECT_PROPERTIES, 10, |
| 51 "ExportExperimentalFromRuntime"); | 51 "ExportExperimentalFromRuntime"); |
| 52 Bootstrapper::ExportExperimentalFromRuntime(isolate, container); | 52 Bootstrapper::ExportExperimentalFromRuntime(isolate, container); |
| 53 JSObject::MigrateSlowToFast(container, 0, "ExportExperimentalFromRuntime"); | 53 JSObject::MigrateSlowToFast(container, 0, "ExportExperimentalFromRuntime"); |
| 54 return *container; | 54 return *container; |
| 55 } | 55 } |
| 56 | 56 |
| 57 | 57 |
| 58 RUNTIME_FUNCTION(Runtime_InstallToContext) { | 58 RUNTIME_FUNCTION(Runtime_InstallToContext) { |
| 59 HandleScope scope(isolate); | 59 HandleScope scope(isolate); |
| 60 DCHECK(args.length() == 1); | 60 DCHECK_EQ(1, args.length()); |
| 61 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); | 61 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); |
| 62 CHECK(array->HasFastElements()); | 62 CHECK(array->HasFastElements()); |
| 63 CHECK(isolate->bootstrapper()->IsActive()); | 63 CHECK(isolate->bootstrapper()->IsActive()); |
| 64 Handle<Context> native_context = isolate->native_context(); | 64 Handle<Context> native_context = isolate->native_context(); |
| 65 Handle<FixedArray> fixed_array(FixedArray::cast(array->elements())); | 65 Handle<FixedArray> fixed_array(FixedArray::cast(array->elements())); |
| 66 int length = Smi::cast(array->length())->value(); | 66 int length = Smi::cast(array->length())->value(); |
| 67 for (int i = 0; i < length; i += 2) { | 67 for (int i = 0; i < length; i += 2) { |
| 68 CHECK(fixed_array->get(i)->IsString()); | 68 CHECK(fixed_array->get(i)->IsString()); |
| 69 Handle<String> name(String::cast(fixed_array->get(i))); | 69 Handle<String> name(String::cast(fixed_array->get(i))); |
| 70 CHECK(fixed_array->get(i + 1)->IsJSObject()); | 70 CHECK(fixed_array->get(i + 1)->IsJSObject()); |
| 71 Handle<JSObject> object(JSObject::cast(fixed_array->get(i + 1))); | 71 Handle<JSObject> object(JSObject::cast(fixed_array->get(i + 1))); |
| 72 int index = Context::ImportedFieldIndexForName(name); | 72 int index = Context::ImportedFieldIndexForName(name); |
| 73 if (index == Context::kNotFound) { | 73 if (index == Context::kNotFound) { |
| 74 index = Context::IntrinsicIndexForName(name); | 74 index = Context::IntrinsicIndexForName(name); |
| 75 } | 75 } |
| 76 CHECK(index != Context::kNotFound); | 76 CHECK(index != Context::kNotFound); |
| 77 native_context->set(index, *object); | 77 native_context->set(index, *object); |
| 78 } | 78 } |
| 79 return isolate->heap()->undefined_value(); | 79 return isolate->heap()->undefined_value(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 | 82 |
| 83 RUNTIME_FUNCTION(Runtime_Throw) { | 83 RUNTIME_FUNCTION(Runtime_Throw) { |
| 84 HandleScope scope(isolate); | 84 HandleScope scope(isolate); |
| 85 DCHECK(args.length() == 1); | 85 DCHECK_EQ(1, args.length()); |
| 86 return isolate->Throw(args[0]); | 86 return isolate->Throw(args[0]); |
| 87 } | 87 } |
| 88 | 88 |
| 89 | 89 |
| 90 RUNTIME_FUNCTION(Runtime_ReThrow) { | 90 RUNTIME_FUNCTION(Runtime_ReThrow) { |
| 91 HandleScope scope(isolate); | 91 HandleScope scope(isolate); |
| 92 DCHECK(args.length() == 1); | 92 DCHECK_EQ(1, args.length()); |
| 93 return isolate->ReThrow(args[0]); | 93 return isolate->ReThrow(args[0]); |
| 94 } | 94 } |
| 95 | 95 |
| 96 | 96 |
| 97 RUNTIME_FUNCTION(Runtime_ThrowStackOverflow) { | 97 RUNTIME_FUNCTION(Runtime_ThrowStackOverflow) { |
| 98 SealHandleScope shs(isolate); | 98 SealHandleScope shs(isolate); |
| 99 DCHECK_LE(0, args.length()); | 99 DCHECK_LE(0, args.length()); |
| 100 return isolate->StackOverflow(); | 100 return isolate->StackOverflow(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 RUNTIME_FUNCTION(Runtime_ThrowTypeError) { | 103 RUNTIME_FUNCTION(Runtime_ThrowTypeError) { |
| 104 HandleScope scope(isolate); | 104 HandleScope scope(isolate); |
| 105 DCHECK_LE(1, args.length()); | 105 DCHECK_LE(1, args.length()); |
| 106 CONVERT_SMI_ARG_CHECKED(message_id_smi, 0); | 106 CONVERT_SMI_ARG_CHECKED(message_id_smi, 0); |
| 107 | 107 |
| 108 Handle<Object> undefined = isolate->factory()->undefined_value(); | 108 Handle<Object> undefined = isolate->factory()->undefined_value(); |
| 109 Handle<Object> arg0 = (args.length() > 1) ? args.at(1) : undefined; | 109 Handle<Object> arg0 = (args.length() > 1) ? args.at(1) : undefined; |
| 110 Handle<Object> arg1 = (args.length() > 2) ? args.at(2) : undefined; | 110 Handle<Object> arg1 = (args.length() > 2) ? args.at(2) : undefined; |
| 111 Handle<Object> arg2 = (args.length() > 3) ? args.at(3) : undefined; | 111 Handle<Object> arg2 = (args.length() > 3) ? args.at(3) : undefined; |
| 112 | 112 |
| 113 MessageTemplate::Template message_id = | 113 MessageTemplate::Template message_id = |
| 114 static_cast<MessageTemplate::Template>(message_id_smi); | 114 static_cast<MessageTemplate::Template>(message_id_smi); |
| 115 | 115 |
| 116 THROW_NEW_ERROR_RETURN_FAILURE(isolate, | 116 THROW_NEW_ERROR_RETURN_FAILURE(isolate, |
| 117 NewTypeError(message_id, arg0, arg1, arg2)); | 117 NewTypeError(message_id, arg0, arg1, arg2)); |
| 118 } | 118 } |
| 119 | 119 |
| 120 RUNTIME_FUNCTION(Runtime_UnwindAndFindExceptionHandler) { | 120 RUNTIME_FUNCTION(Runtime_UnwindAndFindExceptionHandler) { |
| 121 SealHandleScope shs(isolate); | 121 SealHandleScope shs(isolate); |
| 122 DCHECK(args.length() == 0); | 122 DCHECK_EQ(0, args.length()); |
| 123 return isolate->UnwindAndFindHandler(); | 123 return isolate->UnwindAndFindHandler(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 | 126 |
| 127 RUNTIME_FUNCTION(Runtime_PromoteScheduledException) { | 127 RUNTIME_FUNCTION(Runtime_PromoteScheduledException) { |
| 128 SealHandleScope shs(isolate); | 128 SealHandleScope shs(isolate); |
| 129 DCHECK(args.length() == 0); | 129 DCHECK_EQ(0, args.length()); |
| 130 return isolate->PromoteScheduledException(); | 130 return isolate->PromoteScheduledException(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 | 133 |
| 134 RUNTIME_FUNCTION(Runtime_ThrowReferenceError) { | 134 RUNTIME_FUNCTION(Runtime_ThrowReferenceError) { |
| 135 HandleScope scope(isolate); | 135 HandleScope scope(isolate); |
| 136 DCHECK(args.length() == 1); | 136 DCHECK_EQ(1, args.length()); |
| 137 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); | 137 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); |
| 138 THROW_NEW_ERROR_RETURN_FAILURE( | 138 THROW_NEW_ERROR_RETURN_FAILURE( |
| 139 isolate, NewReferenceError(MessageTemplate::kNotDefined, name)); | 139 isolate, NewReferenceError(MessageTemplate::kNotDefined, name)); |
| 140 } | 140 } |
| 141 | 141 |
| 142 | 142 |
| 143 RUNTIME_FUNCTION(Runtime_NewTypeError) { | 143 RUNTIME_FUNCTION(Runtime_NewTypeError) { |
| 144 HandleScope scope(isolate); | 144 HandleScope scope(isolate); |
| 145 DCHECK(args.length() == 2); | 145 DCHECK_EQ(2, args.length()); |
| 146 CONVERT_INT32_ARG_CHECKED(template_index, 0); | 146 CONVERT_INT32_ARG_CHECKED(template_index, 0); |
| 147 CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 1); | 147 CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 1); |
| 148 auto message_template = | 148 auto message_template = |
| 149 static_cast<MessageTemplate::Template>(template_index); | 149 static_cast<MessageTemplate::Template>(template_index); |
| 150 return *isolate->factory()->NewTypeError(message_template, arg0); | 150 return *isolate->factory()->NewTypeError(message_template, arg0); |
| 151 } | 151 } |
| 152 | 152 |
| 153 | 153 |
| 154 RUNTIME_FUNCTION(Runtime_NewReferenceError) { | 154 RUNTIME_FUNCTION(Runtime_NewReferenceError) { |
| 155 HandleScope scope(isolate); | 155 HandleScope scope(isolate); |
| 156 DCHECK(args.length() == 2); | 156 DCHECK_EQ(2, args.length()); |
| 157 CONVERT_INT32_ARG_CHECKED(template_index, 0); | 157 CONVERT_INT32_ARG_CHECKED(template_index, 0); |
| 158 CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 1); | 158 CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 1); |
| 159 auto message_template = | 159 auto message_template = |
| 160 static_cast<MessageTemplate::Template>(template_index); | 160 static_cast<MessageTemplate::Template>(template_index); |
| 161 return *isolate->factory()->NewReferenceError(message_template, arg0); | 161 return *isolate->factory()->NewReferenceError(message_template, arg0); |
| 162 } | 162 } |
| 163 | 163 |
| 164 | 164 |
| 165 RUNTIME_FUNCTION(Runtime_NewSyntaxError) { | 165 RUNTIME_FUNCTION(Runtime_NewSyntaxError) { |
| 166 HandleScope scope(isolate); | 166 HandleScope scope(isolate); |
| 167 DCHECK(args.length() == 2); | 167 DCHECK_EQ(2, args.length()); |
| 168 CONVERT_INT32_ARG_CHECKED(template_index, 0); | 168 CONVERT_INT32_ARG_CHECKED(template_index, 0); |
| 169 CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 1); | 169 CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 1); |
| 170 auto message_template = | 170 auto message_template = |
| 171 static_cast<MessageTemplate::Template>(template_index); | 171 static_cast<MessageTemplate::Template>(template_index); |
| 172 return *isolate->factory()->NewSyntaxError(message_template, arg0); | 172 return *isolate->factory()->NewSyntaxError(message_template, arg0); |
| 173 } | 173 } |
| 174 | 174 |
| 175 RUNTIME_FUNCTION(Runtime_ThrowCannotConvertToPrimitive) { | 175 RUNTIME_FUNCTION(Runtime_ThrowCannotConvertToPrimitive) { |
| 176 HandleScope scope(isolate); | 176 HandleScope scope(isolate); |
| 177 THROW_NEW_ERROR_RETURN_FAILURE( | 177 THROW_NEW_ERROR_RETURN_FAILURE( |
| 178 isolate, NewTypeError(MessageTemplate::kCannotConvertToPrimitive)); | 178 isolate, NewTypeError(MessageTemplate::kCannotConvertToPrimitive)); |
| 179 } | 179 } |
| 180 | 180 |
| 181 RUNTIME_FUNCTION(Runtime_ThrowIllegalInvocation) { | 181 RUNTIME_FUNCTION(Runtime_ThrowIllegalInvocation) { |
| 182 HandleScope scope(isolate); | 182 HandleScope scope(isolate); |
| 183 DCHECK(args.length() == 0); | 183 DCHECK_EQ(0, args.length()); |
| 184 THROW_NEW_ERROR_RETURN_FAILURE( | 184 THROW_NEW_ERROR_RETURN_FAILURE( |
| 185 isolate, NewTypeError(MessageTemplate::kIllegalInvocation)); | 185 isolate, NewTypeError(MessageTemplate::kIllegalInvocation)); |
| 186 } | 186 } |
| 187 | 187 |
| 188 RUNTIME_FUNCTION(Runtime_ThrowIncompatibleMethodReceiver) { | 188 RUNTIME_FUNCTION(Runtime_ThrowIncompatibleMethodReceiver) { |
| 189 HandleScope scope(isolate); | 189 HandleScope scope(isolate); |
| 190 DCHECK_EQ(2, args.length()); | 190 DCHECK_EQ(2, args.length()); |
| 191 CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 0); | 191 CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 0); |
| 192 CONVERT_ARG_HANDLE_CHECKED(Object, arg1, 1); | 192 CONVERT_ARG_HANDLE_CHECKED(Object, arg1, 1); |
| 193 THROW_NEW_ERROR_RETURN_FAILURE( | 193 THROW_NEW_ERROR_RETURN_FAILURE( |
| 194 isolate, | 194 isolate, |
| 195 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, arg0, arg1)); | 195 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, arg0, arg1)); |
| 196 } | 196 } |
| 197 | 197 |
| 198 RUNTIME_FUNCTION(Runtime_ThrowInvalidHint) { | 198 RUNTIME_FUNCTION(Runtime_ThrowInvalidHint) { |
| 199 HandleScope scope(isolate); | 199 HandleScope scope(isolate); |
| 200 DCHECK_EQ(1, args.length()); | 200 DCHECK_EQ(1, args.length()); |
| 201 CONVERT_ARG_HANDLE_CHECKED(Object, hint, 0); | 201 CONVERT_ARG_HANDLE_CHECKED(Object, hint, 0); |
| 202 THROW_NEW_ERROR_RETURN_FAILURE( | 202 THROW_NEW_ERROR_RETURN_FAILURE( |
| 203 isolate, NewTypeError(MessageTemplate::kInvalidHint, hint)); | 203 isolate, NewTypeError(MessageTemplate::kInvalidHint, hint)); |
| 204 } | 204 } |
| 205 | 205 |
| 206 RUNTIME_FUNCTION(Runtime_ThrowInvalidStringLength) { | 206 RUNTIME_FUNCTION(Runtime_ThrowInvalidStringLength) { |
| 207 HandleScope scope(isolate); | 207 HandleScope scope(isolate); |
| 208 THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewInvalidStringLengthError()); | 208 THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewInvalidStringLengthError()); |
| 209 } | 209 } |
| 210 | 210 |
| 211 RUNTIME_FUNCTION(Runtime_ThrowIteratorResultNotAnObject) { | 211 RUNTIME_FUNCTION(Runtime_ThrowIteratorResultNotAnObject) { |
| 212 HandleScope scope(isolate); | 212 HandleScope scope(isolate); |
| 213 DCHECK(args.length() == 1); | 213 DCHECK_EQ(1, args.length()); |
| 214 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); | 214 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); |
| 215 THROW_NEW_ERROR_RETURN_FAILURE( | 215 THROW_NEW_ERROR_RETURN_FAILURE( |
| 216 isolate, | 216 isolate, |
| 217 NewTypeError(MessageTemplate::kIteratorResultNotAnObject, value)); | 217 NewTypeError(MessageTemplate::kIteratorResultNotAnObject, value)); |
| 218 } | 218 } |
| 219 | 219 |
| 220 RUNTIME_FUNCTION(Runtime_ThrowSymbolIteratorInvalid) { | 220 RUNTIME_FUNCTION(Runtime_ThrowSymbolIteratorInvalid) { |
| 221 HandleScope scope(isolate); | 221 HandleScope scope(isolate); |
| 222 DCHECK(args.length() == 0); | 222 DCHECK_EQ(0, args.length()); |
| 223 THROW_NEW_ERROR_RETURN_FAILURE( | 223 THROW_NEW_ERROR_RETURN_FAILURE( |
| 224 isolate, NewTypeError(MessageTemplate::kSymbolIteratorInvalid)); | 224 isolate, NewTypeError(MessageTemplate::kSymbolIteratorInvalid)); |
| 225 } | 225 } |
| 226 | 226 |
| 227 RUNTIME_FUNCTION(Runtime_ThrowNotGeneric) { | 227 RUNTIME_FUNCTION(Runtime_ThrowNotGeneric) { |
| 228 HandleScope scope(isolate); | 228 HandleScope scope(isolate); |
| 229 DCHECK_EQ(1, args.length()); | 229 DCHECK_EQ(1, args.length()); |
| 230 CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 0); | 230 CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 0); |
| 231 THROW_NEW_ERROR_RETURN_FAILURE( | 231 THROW_NEW_ERROR_RETURN_FAILURE( |
| 232 isolate, NewTypeError(MessageTemplate::kNotGeneric, arg0)); | 232 isolate, NewTypeError(MessageTemplate::kNotGeneric, arg0)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 244 DCHECK_EQ(1, args.length()); | 244 DCHECK_EQ(1, args.length()); |
| 245 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 245 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
| 246 Handle<String> type = Object::TypeOf(isolate, object); | 246 Handle<String> type = Object::TypeOf(isolate, object); |
| 247 THROW_NEW_ERROR_RETURN_FAILURE( | 247 THROW_NEW_ERROR_RETURN_FAILURE( |
| 248 isolate, NewTypeError(MessageTemplate::kApplyNonFunction, object, type)); | 248 isolate, NewTypeError(MessageTemplate::kApplyNonFunction, object, type)); |
| 249 } | 249 } |
| 250 | 250 |
| 251 | 251 |
| 252 RUNTIME_FUNCTION(Runtime_StackGuard) { | 252 RUNTIME_FUNCTION(Runtime_StackGuard) { |
| 253 SealHandleScope shs(isolate); | 253 SealHandleScope shs(isolate); |
| 254 DCHECK(args.length() == 0); | 254 DCHECK_EQ(0, args.length()); |
| 255 | 255 |
| 256 // First check if this is a real stack overflow. | 256 // First check if this is a real stack overflow. |
| 257 StackLimitCheck check(isolate); | 257 StackLimitCheck check(isolate); |
| 258 if (check.JsHasOverflowed()) { | 258 if (check.JsHasOverflowed()) { |
| 259 return isolate->StackOverflow(); | 259 return isolate->StackOverflow(); |
| 260 } | 260 } |
| 261 | 261 |
| 262 return isolate->stack_guard()->HandleInterrupts(); | 262 return isolate->stack_guard()->HandleInterrupts(); |
| 263 } | 263 } |
| 264 | 264 |
| 265 | 265 |
| 266 RUNTIME_FUNCTION(Runtime_Interrupt) { | 266 RUNTIME_FUNCTION(Runtime_Interrupt) { |
| 267 SealHandleScope shs(isolate); | 267 SealHandleScope shs(isolate); |
| 268 DCHECK(args.length() == 0); | 268 DCHECK_EQ(0, args.length()); |
| 269 return isolate->stack_guard()->HandleInterrupts(); | 269 return isolate->stack_guard()->HandleInterrupts(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 | 272 |
| 273 RUNTIME_FUNCTION(Runtime_AllocateInNewSpace) { | 273 RUNTIME_FUNCTION(Runtime_AllocateInNewSpace) { |
| 274 HandleScope scope(isolate); | 274 HandleScope scope(isolate); |
| 275 DCHECK(args.length() == 1); | 275 DCHECK_EQ(1, args.length()); |
| 276 CONVERT_SMI_ARG_CHECKED(size, 0); | 276 CONVERT_SMI_ARG_CHECKED(size, 0); |
| 277 CHECK(IsAligned(size, kPointerSize)); | 277 CHECK(IsAligned(size, kPointerSize)); |
| 278 CHECK(size > 0); | 278 CHECK(size > 0); |
| 279 CHECK(size <= kMaxRegularHeapObjectSize); | 279 CHECK(size <= kMaxRegularHeapObjectSize); |
| 280 return *isolate->factory()->NewFillerObject(size, false, NEW_SPACE); | 280 return *isolate->factory()->NewFillerObject(size, false, NEW_SPACE); |
| 281 } | 281 } |
| 282 | 282 |
| 283 | 283 |
| 284 RUNTIME_FUNCTION(Runtime_AllocateInTargetSpace) { | 284 RUNTIME_FUNCTION(Runtime_AllocateInTargetSpace) { |
| 285 HandleScope scope(isolate); | 285 HandleScope scope(isolate); |
| 286 DCHECK(args.length() == 2); | 286 DCHECK_EQ(2, args.length()); |
| 287 CONVERT_SMI_ARG_CHECKED(size, 0); | 287 CONVERT_SMI_ARG_CHECKED(size, 0); |
| 288 CONVERT_SMI_ARG_CHECKED(flags, 1); | 288 CONVERT_SMI_ARG_CHECKED(flags, 1); |
| 289 CHECK(IsAligned(size, kPointerSize)); | 289 CHECK(IsAligned(size, kPointerSize)); |
| 290 CHECK(size > 0); | 290 CHECK(size > 0); |
| 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 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 487 |
| 488 RUNTIME_FUNCTION(Runtime_Typeof) { | 488 RUNTIME_FUNCTION(Runtime_Typeof) { |
| 489 HandleScope scope(isolate); | 489 HandleScope scope(isolate); |
| 490 DCHECK_EQ(1, args.length()); | 490 DCHECK_EQ(1, args.length()); |
| 491 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 491 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
| 492 return *Object::TypeOf(isolate, object); | 492 return *Object::TypeOf(isolate, object); |
| 493 } | 493 } |
| 494 | 494 |
| 495 } // namespace internal | 495 } // namespace internal |
| 496 } // namespace v8 | 496 } // namespace v8 |
| OLD | NEW |