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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 | 255 |
256 RUNTIME_FUNCTION(Runtime_FinalizeClassDefinition) { | 256 RUNTIME_FUNCTION(Runtime_FinalizeClassDefinition) { |
257 HandleScope scope(isolate); | 257 HandleScope scope(isolate); |
258 DCHECK(args.length() == 2); | 258 DCHECK(args.length() == 2); |
259 CONVERT_ARG_HANDLE_CHECKED(JSObject, constructor, 0); | 259 CONVERT_ARG_HANDLE_CHECKED(JSObject, constructor, 0); |
260 CONVERT_ARG_HANDLE_CHECKED(JSObject, prototype, 1); | 260 CONVERT_ARG_HANDLE_CHECKED(JSObject, prototype, 1); |
261 | 261 |
262 JSObject::MigrateSlowToFast(prototype, 0, "RuntimeToFastProperties"); | 262 JSObject::MigrateSlowToFast(prototype, 0, "RuntimeToFastProperties"); |
263 JSObject::MigrateSlowToFast(constructor, 0, "RuntimeToFastProperties"); | 263 JSObject::MigrateSlowToFast(constructor, 0, "RuntimeToFastProperties"); |
264 | 264 |
265 if (constructor->map()->is_strong()) { | |
266 RETURN_FAILURE_ON_EXCEPTION(isolate, JSObject::Freeze(prototype)); | |
rossberg
2015/08/05 14:25:58
How about adding a DCHECK(prototype->map()->is_str
conradw
2015/08/05 14:30:00
Done.
| |
267 Handle<Object> result; | |
268 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | |
269 JSObject::Freeze(constructor)); | |
270 return *result; | |
271 } | |
265 return *constructor; | 272 return *constructor; |
266 } | 273 } |
267 | 274 |
268 | 275 |
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 | |
286 RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) { | 276 RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) { |
287 HandleScope shs(isolate); | 277 HandleScope shs(isolate); |
288 DCHECK(args.length() == 1); | 278 DCHECK(args.length() == 1); |
289 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); | 279 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); |
290 | 280 |
291 Handle<Object> script; | 281 Handle<Object> script; |
292 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 282 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
293 isolate, script, | 283 isolate, script, |
294 Object::GetProperty(fun, isolate->factory()->class_script_symbol())); | 284 Object::GetProperty(fun, isolate->factory()->class_script_symbol())); |
295 if (!script->IsScript()) { | 285 if (!script->IsScript()) { |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
590 Handle<Object> result; | 580 Handle<Object> result; |
591 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 581 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
592 isolate, result, | 582 isolate, result, |
593 Execution::Call(isolate, reflect, isolate->factory()->undefined_value(), | 583 Execution::Call(isolate, reflect, isolate->factory()->undefined_value(), |
594 arraysize(argv), argv)); | 584 arraysize(argv), argv)); |
595 | 585 |
596 return *result; | 586 return *result; |
597 } | 587 } |
598 } // namespace internal | 588 } // namespace internal |
599 } // namespace v8 | 589 } // namespace v8 |
OLD | NEW |