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/bootstrapper.cc

Issue 367763003: Remove SetOwnPropertyIgnoreAttribute uses from the bootstrapper (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 | « no previous file | 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 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/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/extensions/externalize-string-extension.h" 9 #include "src/extensions/externalize-string-extension.h"
10 #include "src/extensions/free-buffer-extension.h" 10 #include "src/extensions/free-buffer-extension.h"
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 if (!proto_template->IsUndefined()) { 762 if (!proto_template->IsUndefined()) {
763 js_global_object_template = 763 js_global_object_template =
764 Handle<ObjectTemplateInfo>::cast(proto_template); 764 Handle<ObjectTemplateInfo>::cast(proto_template);
765 } 765 }
766 } 766 }
767 767
768 if (js_global_object_template.is_null()) { 768 if (js_global_object_template.is_null()) {
769 Handle<String> name = Handle<String>(heap()->empty_string()); 769 Handle<String> name = Handle<String>(heap()->empty_string());
770 Handle<Code> code = Handle<Code>(isolate()->builtins()->builtin( 770 Handle<Code> code = Handle<Code>(isolate()->builtins()->builtin(
771 Builtins::kIllegal)); 771 Builtins::kIllegal));
772 Handle<JSObject> prototype = factory()->NewFunctionPrototype(
773 isolate()->object_function());
772 js_global_object_function = factory()->NewFunction( 774 js_global_object_function = factory()->NewFunction(
773 name, code, JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize); 775 name, code, prototype, JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize);
774 // Change the constructor property of the prototype of the 776 #ifdef DEBUG
775 // hidden global function to refer to the Object function. 777 LookupIterator it(prototype, factory()->constructor_string(),
776 Handle<JSObject> prototype = 778 LookupIterator::CHECK_OWN_REAL);
777 Handle<JSObject>( 779 Handle<Object> value = JSReceiver::GetProperty(&it).ToHandleChecked();
778 JSObject::cast(js_global_object_function->instance_prototype())); 780 ASSERT(it.IsFound());
779 JSObject::SetOwnPropertyIgnoreAttributes( 781 ASSERT_EQ(*isolate()->object_function(), *value);
780 prototype, factory()->constructor_string(), 782 #endif
781 isolate()->object_function(), NONE).Check();
782 } else { 783 } else {
783 Handle<FunctionTemplateInfo> js_global_object_constructor( 784 Handle<FunctionTemplateInfo> js_global_object_constructor(
784 FunctionTemplateInfo::cast(js_global_object_template->constructor())); 785 FunctionTemplateInfo::cast(js_global_object_template->constructor()));
785 js_global_object_function = 786 js_global_object_function =
786 factory()->CreateApiFunction(js_global_object_constructor, 787 factory()->CreateApiFunction(js_global_object_constructor,
787 factory()->the_hole_value(), 788 factory()->the_hole_value(),
788 factory()->GlobalObjectType); 789 factory()->GlobalObjectType);
789 } 790 }
790 791
791 js_global_object_function->initial_map()->set_is_hidden_prototype(); 792 js_global_object_function->initial_map()->set_is_hidden_prototype();
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2129 BootstrapperActive active(this); 2130 BootstrapperActive active(this);
2130 SaveContext saved_context(isolate_); 2131 SaveContext saved_context(isolate_);
2131 isolate_->set_context(*native_context); 2132 isolate_->set_context(*native_context);
2132 return Genesis::InstallExtensions(native_context, extensions) && 2133 return Genesis::InstallExtensions(native_context, extensions) &&
2133 Genesis::InstallSpecialObjects(native_context); 2134 Genesis::InstallSpecialObjects(native_context);
2134 } 2135 }
2135 2136
2136 2137
2137 bool Genesis::InstallSpecialObjects(Handle<Context> native_context) { 2138 bool Genesis::InstallSpecialObjects(Handle<Context> native_context) {
2138 Isolate* isolate = native_context->GetIsolate(); 2139 Isolate* isolate = native_context->GetIsolate();
2140 // Don't install extensions into the snapshot.
2141 if (isolate->serializer_enabled()) return true;
2142
2139 Factory* factory = isolate->factory(); 2143 Factory* factory = isolate->factory();
2140 HandleScope scope(isolate); 2144 HandleScope scope(isolate);
2141 Handle<JSGlobalObject> global(JSGlobalObject::cast( 2145 Handle<JSGlobalObject> global(JSGlobalObject::cast(
2142 native_context->global_object())); 2146 native_context->global_object()));
2147
2148 Handle<JSObject> Error = Handle<JSObject>::cast(Object::GetProperty(
2149 isolate, global, "Error").ToHandleChecked());
2150 Handle<String> name = factory->InternalizeOneByteString(
2151 STATIC_ASCII_VECTOR("stackTraceLimit"));
2152 Handle<Smi> stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit), isolate);
2153 JSObject::AddProperty(Error, name, stack_trace_limit, NONE);
2154
2143 // Expose the natives in global if a name for it is specified. 2155 // Expose the natives in global if a name for it is specified.
2144 if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) { 2156 if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) {
2145 Handle<String> natives = 2157 Handle<String> natives =
2146 factory->InternalizeUtf8String(FLAG_expose_natives_as); 2158 factory->InternalizeUtf8String(FLAG_expose_natives_as);
2147 RETURN_ON_EXCEPTION_VALUE( 2159 JSObject::AddProperty(
2148 isolate, 2160 global, natives, handle(global->builtins()), DONT_ENUM);
2149 JSObject::SetOwnPropertyIgnoreAttributes(
2150 global, natives, Handle<JSObject>(global->builtins()), DONT_ENUM),
2151 false);
2152 }
2153
2154 Handle<Object> Error = Object::GetProperty(
2155 isolate, global, "Error").ToHandleChecked();
2156 if (Error->IsJSObject()) {
2157 Handle<String> name = factory->InternalizeOneByteString(
2158 STATIC_ASCII_VECTOR("stackTraceLimit"));
2159 Handle<Smi> stack_trace_limit(
2160 Smi::FromInt(FLAG_stack_trace_limit), isolate);
2161 RETURN_ON_EXCEPTION_VALUE(
2162 isolate,
2163 JSObject::SetOwnPropertyIgnoreAttributes(
2164 Handle<JSObject>::cast(Error), name, stack_trace_limit, NONE),
2165 false);
2166 } 2161 }
2167 2162
2168 // Expose the debug global object in global if a name for it is specified. 2163 // Expose the debug global object in global if a name for it is specified.
2169 if (FLAG_expose_debug_as != NULL && strlen(FLAG_expose_debug_as) != 0) { 2164 if (FLAG_expose_debug_as != NULL && strlen(FLAG_expose_debug_as) != 0) {
2170 // If loading fails we just bail out without installing the 2165 // If loading fails we just bail out without installing the
2171 // debugger but without tanking the whole context. 2166 // debugger but without tanking the whole context.
2172 Debug* debug = isolate->debug(); 2167 Debug* debug = isolate->debug();
2173 if (!debug->Load()) return true; 2168 if (!debug->Load()) return true;
2174 Handle<Context> debug_context = debug->debug_context(); 2169 Handle<Context> debug_context = debug->debug_context();
2175 // Set the security token for the debugger context to the same as 2170 // Set the security token for the debugger context to the same as
2176 // the shell native context to allow calling between these (otherwise 2171 // the shell native context to allow calling between these (otherwise
2177 // exposing debug global object doesn't make much sense). 2172 // exposing debug global object doesn't make much sense).
2178 debug_context->set_security_token(native_context->security_token()); 2173 debug_context->set_security_token(native_context->security_token());
2179 Handle<String> debug_string = 2174 Handle<String> debug_string =
2180 factory->InternalizeUtf8String(FLAG_expose_debug_as); 2175 factory->InternalizeUtf8String(FLAG_expose_debug_as);
2181 Handle<Object> global_proxy(debug_context->global_proxy(), isolate); 2176 Handle<Object> global_proxy(debug_context->global_proxy(), isolate);
2182 RETURN_ON_EXCEPTION_VALUE( 2177 JSObject::AddProperty(global, debug_string, global_proxy, DONT_ENUM);
2183 isolate,
2184 JSObject::SetOwnPropertyIgnoreAttributes(
2185 global, debug_string, global_proxy, DONT_ENUM),
2186 false);
2187 } 2178 }
2188 return true; 2179 return true;
2189 } 2180 }
2190 2181
2191 2182
2192 static uint32_t Hash(RegisteredExtension* extension) { 2183 static uint32_t Hash(RegisteredExtension* extension) {
2193 return v8::internal::ComputePointerHash(extension); 2184 return v8::internal::ComputePointerHash(extension);
2194 } 2185 }
2195 2186
2196 2187
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
2690 return from + sizeof(NestingCounterType); 2681 return from + sizeof(NestingCounterType);
2691 } 2682 }
2692 2683
2693 2684
2694 // Called when the top-level V8 mutex is destroyed. 2685 // Called when the top-level V8 mutex is destroyed.
2695 void Bootstrapper::FreeThreadResources() { 2686 void Bootstrapper::FreeThreadResources() {
2696 ASSERT(!IsActive()); 2687 ASSERT(!IsActive());
2697 } 2688 }
2698 2689
2699 } } // namespace v8::internal 2690 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698