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

Side by Side Diff: src/heap.cc

Issue 7035007: Implement get trap for proxies. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Implementing get trap for proxies. Created 9 years, 7 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
OLDNEW
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 3195 matching lines...) Expand 10 before | Expand all | Expand 10 after
3206 AllocateJSObjectFromMap(constructor->initial_map(), pretenure); 3206 AllocateJSObjectFromMap(constructor->initial_map(), pretenure);
3207 #ifdef DEBUG 3207 #ifdef DEBUG
3208 // Make sure result is NOT a global object if valid. 3208 // Make sure result is NOT a global object if valid.
3209 Object* non_failure; 3209 Object* non_failure;
3210 ASSERT(!result->ToObject(&non_failure) || !non_failure->IsGlobalObject()); 3210 ASSERT(!result->ToObject(&non_failure) || !non_failure->IsGlobalObject());
3211 #endif 3211 #endif
3212 return result; 3212 return result;
3213 } 3213 }
3214 3214
3215 3215
3216 MaybeObject* Heap::AllocateJSProxy(Object* handler, Object* prototype) {
3217 // Allocate map.
3218 // TODO(rossberg): Once we optimize proxies, think about a scheme to share
3219 // maps. Will probably depend on the identity of the handler object, too.
3220 Object* map_obj;
3221 MaybeObject* maybe_map_obj = AllocateMap(JS_PROXY_TYPE, JSProxy::kSize);
3222 if (!maybe_map_obj->ToObject(&map_obj)) return maybe_map_obj;
3223 Map* map = Map::cast(map_obj);
3224 map->set_prototype(prototype);
3225 map->set_pre_allocated_property_fields(1);
3226 map->set_inobject_properties(1);
3227
3228 // Allocate the proxy object.
3229 Object* result;
3230 MaybeObject* maybe_result = Allocate(map, NEW_SPACE);
3231 if (!maybe_result->ToObject(&result)) return maybe_result;
3232 JSProxy::cast(result)->set_handler(handler);
3233 return result;
3234 }
3235
3236
3216 MaybeObject* Heap::AllocateGlobalObject(JSFunction* constructor) { 3237 MaybeObject* Heap::AllocateGlobalObject(JSFunction* constructor) {
3217 ASSERT(constructor->has_initial_map()); 3238 ASSERT(constructor->has_initial_map());
3218 Map* map = constructor->initial_map(); 3239 Map* map = constructor->initial_map();
3219 3240
3220 // Make sure no field properties are described in the initial map. 3241 // Make sure no field properties are described in the initial map.
3221 // This guarantees us that normalizing the properties does not 3242 // This guarantees us that normalizing the properties does not
3222 // require us to change property values to JSGlobalPropertyCells. 3243 // require us to change property values to JSGlobalPropertyCells.
3223 ASSERT(map->NextFreePropertyIndex() == 0); 3244 ASSERT(map->NextFreePropertyIndex() == 0);
3224 3245
3225 // Make sure we don't have a ton of pre-allocated slots in the 3246 // Make sure we don't have a ton of pre-allocated slots in the
(...skipping 2635 matching lines...) Expand 10 before | Expand all | Expand 10 after
5861 } 5882 }
5862 5883
5863 5884
5864 void ExternalStringTable::TearDown() { 5885 void ExternalStringTable::TearDown() {
5865 new_space_strings_.Free(); 5886 new_space_strings_.Free();
5866 old_space_strings_.Free(); 5887 old_space_strings_.Free();
5867 } 5888 }
5868 5889
5869 5890
5870 } } // namespace v8::internal 5891 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698