Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: src/runtime.cc

Issue 13540003: Remove code duplication in JSObject::HasRealNamedProperty (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Pass Isolate through Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4589 matching lines...) Expand 10 before | Expand all | Expand 10 after
4600 uint32_t index; 4600 uint32_t index;
4601 const bool key_is_array_index = key->AsArrayIndex(&index); 4601 const bool key_is_array_index = key->AsArrayIndex(&index);
4602 4602
4603 Object* obj = args[0]; 4603 Object* obj = args[0];
4604 // Only JS objects can have properties. 4604 // Only JS objects can have properties.
4605 if (obj->IsJSObject()) { 4605 if (obj->IsJSObject()) {
4606 JSObject* object = JSObject::cast(obj); 4606 JSObject* object = JSObject::cast(obj);
4607 // Fast case: either the key is a real named property or it is not 4607 // Fast case: either the key is a real named property or it is not
4608 // an array index and there are no interceptors or hidden 4608 // an array index and there are no interceptors or hidden
4609 // prototypes. 4609 // prototypes.
4610 if (object->HasRealNamedProperty(key)) return isolate->heap()->true_value(); 4610 if (object->HasRealNamedProperty(isolate, key))
4611 return isolate->heap()->true_value();
4611 Map* map = object->map(); 4612 Map* map = object->map();
4612 if (!key_is_array_index && 4613 if (!key_is_array_index &&
4613 !map->has_named_interceptor() && 4614 !map->has_named_interceptor() &&
4614 !HeapObject::cast(map->prototype())->map()->is_hidden_prototype()) { 4615 !HeapObject::cast(map->prototype())->map()->is_hidden_prototype()) {
4615 return isolate->heap()->false_value(); 4616 return isolate->heap()->false_value();
4616 } 4617 }
4617 // Slow case. 4618 // Slow case.
4618 HandleScope scope(isolate); 4619 HandleScope scope(isolate);
4619 return HasLocalPropertyImplementation(isolate, 4620 return HasLocalPropertyImplementation(isolate,
4620 Handle<JSObject>(object), 4621 Handle<JSObject>(object),
(...skipping 8378 matching lines...) Expand 10 before | Expand all | Expand 10 after
12999 // Handle last resort GC and make sure to allow future allocations 13000 // Handle last resort GC and make sure to allow future allocations
13000 // to grow the heap without causing GCs (if possible). 13001 // to grow the heap without causing GCs (if possible).
13001 isolate->counters()->gc_last_resort_from_js()->Increment(); 13002 isolate->counters()->gc_last_resort_from_js()->Increment();
13002 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13003 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13003 "Runtime::PerformGC"); 13004 "Runtime::PerformGC");
13004 } 13005 }
13005 } 13006 }
13006 13007
13007 13008
13008 } } // namespace v8::internal 13009 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698