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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 246 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
247 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 2); | 247 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 2); |
248 | 248 |
249 RETURN_FAILURE_ON_EXCEPTION(isolate, | 249 RETURN_FAILURE_ON_EXCEPTION(isolate, |
250 JSObject::DefinePropertyOrElementIgnoreAttributes( | 250 JSObject::DefinePropertyOrElementIgnoreAttributes( |
251 object, name, function, DONT_ENUM)); | 251 object, name, function, DONT_ENUM)); |
252 return isolate->heap()->undefined_value(); | 252 return isolate->heap()->undefined_value(); |
253 } | 253 } |
254 | 254 |
255 | 255 |
| 256 RUNTIME_FUNCTION(Runtime_FinalizeClassDefinition) { |
| 257 HandleScope scope(isolate); |
| 258 DCHECK(args.length() == 2); |
| 259 CONVERT_ARG_HANDLE_CHECKED(JSObject, constructor, 0); |
| 260 CONVERT_ARG_HANDLE_CHECKED(JSObject, prototype, 1); |
| 261 |
| 262 JSObject::MigrateSlowToFast(prototype, 0, "RuntimeToFastProperties"); |
| 263 JSObject::MigrateSlowToFast(constructor, 0, "RuntimeToFastProperties"); |
| 264 |
| 265 return *constructor; |
| 266 } |
| 267 |
| 268 |
| 269 RUNTIME_FUNCTION(Runtime_FinalizeClassDefinitionStrong) { |
| 270 HandleScope scope(isolate); |
| 271 DCHECK(args.length() == 2); |
| 272 CONVERT_ARG_HANDLE_CHECKED(JSObject, constructor, 0); |
| 273 CONVERT_ARG_HANDLE_CHECKED(JSObject, prototype, 1); |
| 274 |
| 275 JSObject::MigrateSlowToFast(prototype, 0, "RuntimeToFastProperties"); |
| 276 JSObject::MigrateSlowToFast(constructor, 0, "RuntimeToFastProperties"); |
| 277 |
| 278 RETURN_FAILURE_ON_EXCEPTION(isolate, JSObject::Freeze(prototype)); |
| 279 Handle<Object> result; |
| 280 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
| 281 JSObject::Freeze(constructor)); |
| 282 return *result; |
| 283 } |
| 284 |
| 285 |
256 RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) { | 286 RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) { |
257 HandleScope shs(isolate); | 287 HandleScope shs(isolate); |
258 DCHECK(args.length() == 1); | 288 DCHECK(args.length() == 1); |
259 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); | 289 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); |
260 | 290 |
261 Handle<Object> script; | 291 Handle<Object> script; |
262 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 292 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
263 isolate, script, | 293 isolate, script, |
264 Object::GetProperty(fun, isolate->factory()->class_script_symbol())); | 294 Object::GetProperty(fun, isolate->factory()->class_script_symbol())); |
265 if (!script->IsScript()) { | 295 if (!script->IsScript()) { |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 Handle<Object> result; | 590 Handle<Object> result; |
561 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 591 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
562 isolate, result, | 592 isolate, result, |
563 Execution::Call(isolate, reflect, isolate->factory()->undefined_value(), | 593 Execution::Call(isolate, reflect, isolate->factory()->undefined_value(), |
564 arraysize(argv), argv)); | 594 arraysize(argv), argv)); |
565 | 595 |
566 return *result; | 596 return *result; |
567 } | 597 } |
568 } // namespace internal | 598 } // namespace internal |
569 } // namespace v8 | 599 } // namespace v8 |
OLD | NEW |