OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 4089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4100 | 4100 |
4101 return Runtime::SetObjectProperty(isolate, | 4101 return Runtime::SetObjectProperty(isolate, |
4102 object, | 4102 object, |
4103 key, | 4103 key, |
4104 value, | 4104 value, |
4105 attributes, | 4105 attributes, |
4106 strict_mode); | 4106 strict_mode); |
4107 } | 4107 } |
4108 | 4108 |
4109 | 4109 |
| 4110 // Set the ES5 native flag on the function. |
| 4111 // This is used to decide if we should transform null and undefined |
| 4112 // into the global object when doing call and apply. |
| 4113 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetES5Flag) { |
| 4114 NoHandleAllocation ha; |
| 4115 RUNTIME_ASSERT(args.length() == 1); |
| 4116 |
| 4117 Handle<Object> object = args.at<Object>(0); |
| 4118 |
| 4119 if (object->IsJSFunction()) { |
| 4120 JSFunction* func = JSFunction::cast(*object); |
| 4121 func->shared()->set_es5_native(true); |
| 4122 } |
| 4123 return isolate->heap()->undefined_value(); |
| 4124 } |
| 4125 |
| 4126 |
4110 // Set a local property, even if it is READ_ONLY. If the property does not | 4127 // Set a local property, even if it is READ_ONLY. If the property does not |
4111 // exist, it will be added with attributes NONE. | 4128 // exist, it will be added with attributes NONE. |
4112 RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) { | 4129 RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) { |
4113 NoHandleAllocation ha; | 4130 NoHandleAllocation ha; |
4114 RUNTIME_ASSERT(args.length() == 3 || args.length() == 4); | 4131 RUNTIME_ASSERT(args.length() == 3 || args.length() == 4); |
4115 CONVERT_CHECKED(JSObject, object, args[0]); | 4132 CONVERT_CHECKED(JSObject, object, args[0]); |
4116 CONVERT_CHECKED(String, name, args[1]); | 4133 CONVERT_CHECKED(String, name, args[1]); |
4117 // Compute attributes. | 4134 // Compute attributes. |
4118 PropertyAttributes attributes = NONE; | 4135 PropertyAttributes attributes = NONE; |
4119 if (args.length() == 4) { | 4136 if (args.length() == 4) { |
(...skipping 8062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12182 } else { | 12199 } else { |
12183 // Handle last resort GC and make sure to allow future allocations | 12200 // Handle last resort GC and make sure to allow future allocations |
12184 // to grow the heap without causing GCs (if possible). | 12201 // to grow the heap without causing GCs (if possible). |
12185 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12202 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12186 isolate->heap()->CollectAllGarbage(false); | 12203 isolate->heap()->CollectAllGarbage(false); |
12187 } | 12204 } |
12188 } | 12205 } |
12189 | 12206 |
12190 | 12207 |
12191 } } // namespace v8::internal | 12208 } } // namespace v8::internal |
OLD | NEW |