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

Side by Side Diff: src/factory.cc

Issue 352813002: Wrap InitializeProperty around SetOwnPropertyIgnoreAttributes and switch over uses (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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/bootstrapper.cc ('k') | src/isolate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/conversions.h" 7 #include "src/conversions.h"
8 #include "src/isolate-inl.h" 8 #include "src/isolate-inl.h"
9 #include "src/macro-assembler.h" 9 #include "src/macro-assembler.h"
10 10
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 // Each function prototype gets a fresh map to avoid unwanted sharing of 1326 // Each function prototype gets a fresh map to avoid unwanted sharing of
1327 // maps between prototypes of different constructors. 1327 // maps between prototypes of different constructors.
1328 Handle<JSFunction> object_function(native_context->object_function()); 1328 Handle<JSFunction> object_function(native_context->object_function());
1329 ASSERT(object_function->has_initial_map()); 1329 ASSERT(object_function->has_initial_map());
1330 new_map = Map::Copy(handle(object_function->initial_map())); 1330 new_map = Map::Copy(handle(object_function->initial_map()));
1331 } 1331 }
1332 1332
1333 Handle<JSObject> prototype = NewJSObjectFromMap(new_map); 1333 Handle<JSObject> prototype = NewJSObjectFromMap(new_map);
1334 1334
1335 if (!function->shared()->is_generator()) { 1335 if (!function->shared()->is_generator()) {
1336 JSObject::SetOwnPropertyIgnoreAttributes(prototype, 1336 JSObject::AddProperty(prototype, constructor_string(), function, DONT_ENUM);
1337 constructor_string(),
1338 function,
1339 DONT_ENUM).Assert();
1340 } 1337 }
1341 1338
1342 return prototype; 1339 return prototype;
1343 } 1340 }
1344 1341
1345 1342
1346 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( 1343 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
1347 Handle<SharedFunctionInfo> info, 1344 Handle<SharedFunctionInfo> info,
1348 Handle<Context> context, 1345 Handle<Context> context,
1349 PretenureFlag pretenure) { 1346 PretenureFlag pretenure) {
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 result->shared()->set_construct_stub(*construct_stub); 2149 result->shared()->set_construct_stub(*construct_stub);
2153 result->shared()->DontAdaptArguments(); 2150 result->shared()->DontAdaptArguments();
2154 2151
2155 if (obj->remove_prototype()) { 2152 if (obj->remove_prototype()) {
2156 ASSERT(result->shared()->IsApiFunction()); 2153 ASSERT(result->shared()->IsApiFunction());
2157 ASSERT(!result->has_initial_map()); 2154 ASSERT(!result->has_initial_map());
2158 ASSERT(!result->has_prototype()); 2155 ASSERT(!result->has_prototype());
2159 return result; 2156 return result;
2160 } 2157 }
2161 2158
2162 JSObject::SetOwnPropertyIgnoreAttributes( 2159 if (prototype->IsTheHole()) {
2163 handle(JSObject::cast(result->prototype())), 2160 #ifdef DEBUG
2164 constructor_string(), 2161 LookupIterator it(handle(JSObject::cast(result->prototype())),
2165 result, 2162 constructor_string(),
2166 DONT_ENUM).Assert(); 2163 LookupIterator::CHECK_OWN_REAL);
2164 MaybeHandle<Object> maybe_prop = Object::GetProperty(&it);
2165 ASSERT(it.IsFound());
2166 ASSERT(maybe_prop.ToHandleChecked().is_identical_to(result));
2167 #endif
2168 } else {
2169 JSObject::AddProperty(handle(JSObject::cast(result->prototype())),
2170 constructor_string(), result, DONT_ENUM);
2171 }
2167 2172
2168 // Down from here is only valid for API functions that can be used as a 2173 // Down from here is only valid for API functions that can be used as a
2169 // constructor (don't set the "remove prototype" flag). 2174 // constructor (don't set the "remove prototype" flag).
2170 2175
2171 Handle<Map> map(result->initial_map()); 2176 Handle<Map> map(result->initial_map());
2172 2177
2173 // Mark as undetectable if needed. 2178 // Mark as undetectable if needed.
2174 if (obj->undetectable()) { 2179 if (obj->undetectable()) {
2175 map->set_is_undetectable(); 2180 map->set_is_undetectable();
2176 } 2181 }
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
2360 return Handle<Object>::null(); 2365 return Handle<Object>::null();
2361 } 2366 }
2362 2367
2363 2368
2364 Handle<Object> Factory::ToBoolean(bool value) { 2369 Handle<Object> Factory::ToBoolean(bool value) {
2365 return value ? true_value() : false_value(); 2370 return value ? true_value() : false_value();
2366 } 2371 }
2367 2372
2368 2373
2369 } } // namespace v8::internal 2374 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698