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 4220 matching lines...) Loading... | |
4231 } | 4231 } |
4232 | 4232 |
4233 return Runtime::ForceSetObjectProperty(isolate, | 4233 return Runtime::ForceSetObjectProperty(isolate, |
4234 js_object, | 4234 js_object, |
4235 name, | 4235 name, |
4236 obj_value, | 4236 obj_value, |
4237 attr); | 4237 attr); |
4238 } | 4238 } |
4239 | 4239 |
4240 | 4240 |
4241 // Return property without being observable by accessors or interceptors. | |
4242 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDataProperty) { | |
4243 ASSERT(args.length() == 2); | |
4244 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | |
4245 CONVERT_ARG_HANDLE_CHECKED(String, key, 1); | |
4246 LookupResult lookup(isolate); | |
4247 object->LookupRealNamedProperty(*key, &lookup); | |
4248 if (!lookup.IsProperty()) return isolate->heap()->undefined_value(); | |
Sven Panne
2012/11/12 10:14:00
With the change below, this can change to ...!look
| |
4249 switch (lookup.type()) { | |
4250 case NORMAL: | |
4251 return lookup.holder()->GetNormalizedProperty(&lookup); | |
4252 case FIELD: | |
4253 return lookup.holder()->FastPropertyAt(lookup.GetFieldIndex()); | |
4254 case CONSTANT_FUNCTION: | |
4255 return lookup.GetConstantFunction(); | |
4256 default: | |
Sven Panne
2012/11/12 10:14:00
Please explicitly list all PropertyTypes. We shoul
| |
4257 return isolate->heap()->undefined_value(); | |
4258 } | |
4259 } | |
4260 | |
4261 | |
4241 MaybeObject* Runtime::SetObjectProperty(Isolate* isolate, | 4262 MaybeObject* Runtime::SetObjectProperty(Isolate* isolate, |
4242 Handle<Object> object, | 4263 Handle<Object> object, |
4243 Handle<Object> key, | 4264 Handle<Object> key, |
4244 Handle<Object> value, | 4265 Handle<Object> value, |
4245 PropertyAttributes attr, | 4266 PropertyAttributes attr, |
4246 StrictModeFlag strict_mode) { | 4267 StrictModeFlag strict_mode) { |
4247 SetPropertyMode set_mode = attr == NONE ? SET_PROPERTY : DEFINE_PROPERTY; | 4268 SetPropertyMode set_mode = attr == NONE ? SET_PROPERTY : DEFINE_PROPERTY; |
4248 HandleScope scope(isolate); | 4269 HandleScope scope(isolate); |
4249 | 4270 |
4250 if (object->IsUndefined() || object->IsNull()) { | 4271 if (object->IsUndefined() || object->IsNull()) { |
(...skipping 9113 matching lines...) Loading... | |
13364 // Handle last resort GC and make sure to allow future allocations | 13385 // Handle last resort GC and make sure to allow future allocations |
13365 // to grow the heap without causing GCs (if possible). | 13386 // to grow the heap without causing GCs (if possible). |
13366 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13387 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13367 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13388 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13368 "Runtime::PerformGC"); | 13389 "Runtime::PerformGC"); |
13369 } | 13390 } |
13370 } | 13391 } |
13371 | 13392 |
13372 | 13393 |
13373 } } // namespace v8::internal | 13394 } } // namespace v8::internal |
OLD | NEW |