OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 14204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14215 | 14215 |
14216 RUNTIME_FUNCTION(MaybeObject*, Runtime_HaveSameMap) { | 14216 RUNTIME_FUNCTION(MaybeObject*, Runtime_HaveSameMap) { |
14217 SealHandleScope shs(isolate); | 14217 SealHandleScope shs(isolate); |
14218 ASSERT(args.length() == 2); | 14218 ASSERT(args.length() == 2); |
14219 CONVERT_ARG_CHECKED(JSObject, obj1, 0); | 14219 CONVERT_ARG_CHECKED(JSObject, obj1, 0); |
14220 CONVERT_ARG_CHECKED(JSObject, obj2, 1); | 14220 CONVERT_ARG_CHECKED(JSObject, obj2, 1); |
14221 return isolate->heap()->ToBoolean(obj1->map() == obj2->map()); | 14221 return isolate->heap()->ToBoolean(obj1->map() == obj2->map()); |
14222 } | 14222 } |
14223 | 14223 |
14224 | 14224 |
| 14225 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsAccessCheckNeeded) { |
| 14226 SealHandleScope shs(isolate); |
| 14227 ASSERT(args.length() == 1); |
| 14228 CONVERT_ARG_CHECKED(HeapObject, obj, 0); |
| 14229 return isolate->heap()->ToBoolean(obj->IsAccessCheckNeeded()); |
| 14230 } |
| 14231 |
| 14232 |
14225 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsObserved) { | 14233 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsObserved) { |
14226 SealHandleScope shs(isolate); | 14234 SealHandleScope shs(isolate); |
14227 ASSERT(args.length() == 1); | 14235 ASSERT(args.length() == 1); |
14228 | 14236 |
14229 if (!args[0]->IsJSReceiver()) return isolate->heap()->false_value(); | 14237 if (!args[0]->IsJSReceiver()) return isolate->heap()->false_value(); |
14230 JSReceiver* obj = JSReceiver::cast(args[0]); | 14238 JSReceiver* obj = JSReceiver::cast(args[0]); |
14231 if (obj->IsJSGlobalProxy()) { | 14239 if (obj->IsJSGlobalProxy()) { |
14232 Object* proto = obj->GetPrototype(); | 14240 Object* proto = obj->GetPrototype(); |
14233 if (proto->IsNull()) return isolate->heap()->false_value(); | 14241 if (proto->IsNull()) return isolate->heap()->false_value(); |
14234 ASSERT(proto->IsJSGlobalObject()); | 14242 ASSERT(proto->IsJSGlobalObject()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14292 ASSERT(args.length() == 1); | 14300 ASSERT(args.length() == 1); |
14293 Object* object = args[0]; | 14301 Object* object = args[0]; |
14294 if (object->IsJSGlobalProxy()) { | 14302 if (object->IsJSGlobalProxy()) { |
14295 object = object->GetPrototype(isolate); | 14303 object = object->GetPrototype(isolate); |
14296 if (object->IsNull()) return isolate->heap()->undefined_value(); | 14304 if (object->IsNull()) return isolate->heap()->undefined_value(); |
14297 } | 14305 } |
14298 return object; | 14306 return object; |
14299 } | 14307 } |
14300 | 14308 |
14301 | 14309 |
| 14310 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetAccessAllowedForObserver) { |
| 14311 HandleScope scope(isolate); |
| 14312 ASSERT(args.length() == 3); |
| 14313 CONVERT_ARG_HANDLE_CHECKED(JSFunction, observer, 0); |
| 14314 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 1); |
| 14315 ASSERT(object->IsAccessCheckNeeded()); |
| 14316 Handle<Object> key = args.at<Object>(2); |
| 14317 SaveContext save(isolate); |
| 14318 isolate->set_context(observer->context()); |
| 14319 bool access_allowed = false; |
| 14320 uint32_t index = 0; |
| 14321 if (key->ToArrayIndex(&index) || |
| 14322 (key->IsString() && String::cast(*key)->AsArrayIndex(&index))) { |
| 14323 access_allowed = isolate->MayIndexedAccess(*object, index, v8::ACCESS_GET); |
| 14324 } else { |
| 14325 access_allowed = isolate->MayNamedAccess(*object, *key, v8::ACCESS_GET); |
| 14326 } |
| 14327 return isolate->heap()->ToBoolean(access_allowed); |
| 14328 } |
| 14329 |
| 14330 |
14302 static MaybeObject* ArrayConstructorCommon(Isolate* isolate, | 14331 static MaybeObject* ArrayConstructorCommon(Isolate* isolate, |
14303 Handle<JSFunction> constructor, | 14332 Handle<JSFunction> constructor, |
14304 Handle<Object> type_info, | 14333 Handle<Object> type_info, |
14305 Arguments* caller_args) { | 14334 Arguments* caller_args) { |
14306 bool holey = false; | 14335 bool holey = false; |
14307 bool can_use_type_feedback = true; | 14336 bool can_use_type_feedback = true; |
14308 if (caller_args->length() == 1) { | 14337 if (caller_args->length() == 1) { |
14309 Object* argument_one = (*caller_args)[0]; | 14338 Object* argument_one = (*caller_args)[0]; |
14310 if (argument_one->IsSmi()) { | 14339 if (argument_one->IsSmi()) { |
14311 int value = Smi::cast(argument_one)->value(); | 14340 int value = Smi::cast(argument_one)->value(); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14481 // Handle last resort GC and make sure to allow future allocations | 14510 // Handle last resort GC and make sure to allow future allocations |
14482 // to grow the heap without causing GCs (if possible). | 14511 // to grow the heap without causing GCs (if possible). |
14483 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14512 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14484 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14513 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14485 "Runtime::PerformGC"); | 14514 "Runtime::PerformGC"); |
14486 } | 14515 } |
14487 } | 14516 } |
14488 | 14517 |
14489 | 14518 |
14490 } } // namespace v8::internal | 14519 } } // namespace v8::internal |
OLD | NEW |