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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 isolate->ReportFailedAccessCheck(JSObject::cast(obj), v8::ACCESS_GET); | 960 isolate->ReportFailedAccessCheck(JSObject::cast(obj), v8::ACCESS_GET); |
961 return isolate->heap()->undefined_value(); | 961 return isolate->heap()->undefined_value(); |
962 } | 962 } |
963 obj = obj->GetPrototype(isolate); | 963 obj = obj->GetPrototype(isolate); |
964 } while (obj->IsJSObject() && | 964 } while (obj->IsJSObject() && |
965 JSObject::cast(obj)->map()->is_hidden_prototype()); | 965 JSObject::cast(obj)->map()->is_hidden_prototype()); |
966 return obj; | 966 return obj; |
967 } | 967 } |
968 | 968 |
969 | 969 |
| 970 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { |
| 971 NoHandleAllocation ha(isolate); |
| 972 ASSERT(args.length() == 2); |
| 973 CONVERT_ARG_CHECKED(JSReceiver, input_obj, 0); |
| 974 CONVERT_ARG_CHECKED(Object, prototype, 1); |
| 975 return input_obj->SetPrototype(prototype, true); |
| 976 } |
| 977 |
| 978 |
970 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInPrototypeChain) { | 979 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInPrototypeChain) { |
971 NoHandleAllocation ha(isolate); | 980 NoHandleAllocation ha(isolate); |
972 ASSERT(args.length() == 2); | 981 ASSERT(args.length() == 2); |
973 // See ECMA-262, section 15.3.5.3, page 88 (steps 5 - 8). | 982 // See ECMA-262, section 15.3.5.3, page 88 (steps 5 - 8). |
974 Object* O = args[0]; | 983 Object* O = args[0]; |
975 Object* V = args[1]; | 984 Object* V = args[1]; |
976 while (true) { | 985 while (true) { |
977 Object* prototype = V->GetPrototype(isolate); | 986 Object* prototype = V->GetPrototype(isolate); |
978 if (prototype->IsNull()) return isolate->heap()->false_value(); | 987 if (prototype->IsNull()) return isolate->heap()->false_value(); |
979 if (O == prototype) return isolate->heap()->true_value(); | 988 if (O == prototype) return isolate->heap()->true_value(); |
(...skipping 12321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13301 // Handle last resort GC and make sure to allow future allocations | 13310 // Handle last resort GC and make sure to allow future allocations |
13302 // to grow the heap without causing GCs (if possible). | 13311 // to grow the heap without causing GCs (if possible). |
13303 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13312 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13304 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13313 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13305 "Runtime::PerformGC"); | 13314 "Runtime::PerformGC"); |
13306 } | 13315 } |
13307 } | 13316 } |
13308 | 13317 |
13309 | 13318 |
13310 } } // namespace v8::internal | 13319 } } // namespace v8::internal |
OLD | NEW |