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

Side by Side Diff: src/bootstrapper.cc

Issue 1397853005: [es6] Partially implement Reflect.preventExtensions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Sorry Created 5 years, 2 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
« no previous file with comments | « no previous file | src/builtins.h » ('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/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/base/utils/random-number-generator.h" 9 #include "src/base/utils/random-number-generator.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 // %ThrowTypeError% must not have a name property. 694 // %ThrowTypeError% must not have a name property.
695 JSReceiver::DeleteProperty(function, factory()->name_string()).Assert(); 695 JSReceiver::DeleteProperty(function, factory()->name_string()).Assert();
696 696
697 // length needs to be non configurable. 697 // length needs to be non configurable.
698 Handle<Object> value(Smi::FromInt(function->shared()->length()), isolate()); 698 Handle<Object> value(Smi::FromInt(function->shared()->length()), isolate());
699 JSObject::SetOwnPropertyIgnoreAttributes( 699 JSObject::SetOwnPropertyIgnoreAttributes(
700 function, factory()->length_string(), value, 700 function, factory()->length_string(), value,
701 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY)) 701 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY))
702 .Assert(); 702 .Assert();
703 703
704 JSObject::PreventExtensions(function).Assert(); 704 if (JSObject::PreventExtensions(function, THROW_ON_ERROR).IsNothing())
705 DCHECK(false);
705 706
706 return function; 707 return function;
707 } 708 }
708 709
709 710
710 // ECMAScript 5th Edition, 13.2.3 711 // ECMAScript 5th Edition, 13.2.3
711 Handle<JSFunction> Genesis::GetRestrictedFunctionPropertiesThrower() { 712 Handle<JSFunction> Genesis::GetRestrictedFunctionPropertiesThrower() {
712 if (restricted_function_properties_thrower_.is_null()) { 713 if (restricted_function_properties_thrower_.is_null()) {
713 restricted_function_properties_thrower_ = GetThrowTypeErrorIntrinsic( 714 restricted_function_properties_thrower_ = GetThrowTypeErrorIntrinsic(
714 Builtins::kRestrictedFunctionPropertiesThrower); 715 Builtins::kRestrictedFunctionPropertiesThrower);
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
2190 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); 2191 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM);
2191 2192
2192 SimpleInstallFunction(reflect, "deleteProperty", 2193 SimpleInstallFunction(reflect, "deleteProperty",
2193 Builtins::kReflectDeleteProperty, 2, true); 2194 Builtins::kReflectDeleteProperty, 2, true);
2194 SimpleInstallFunction(reflect, "get", 2195 SimpleInstallFunction(reflect, "get",
2195 Builtins::kReflectGet, 3, false); 2196 Builtins::kReflectGet, 3, false);
2196 SimpleInstallFunction(reflect, "has", 2197 SimpleInstallFunction(reflect, "has",
2197 Builtins::kReflectHas, 2, true); 2198 Builtins::kReflectHas, 2, true);
2198 SimpleInstallFunction(reflect, "isExtensible", 2199 SimpleInstallFunction(reflect, "isExtensible",
2199 Builtins::kReflectIsExtensible, 1, true); 2200 Builtins::kReflectIsExtensible, 1, true);
2201 SimpleInstallFunction(reflect, "preventExtensions",
2202 Builtins::kReflectPreventExtensions, 1, true);
2200 } 2203 }
2201 2204
2202 2205
2203 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { 2206 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() {
2204 if (!FLAG_harmony_sharedarraybuffer) return; 2207 if (!FLAG_harmony_sharedarraybuffer) return;
2205 2208
2206 Handle<JSGlobalObject> global( 2209 Handle<JSGlobalObject> global(
2207 JSGlobalObject::cast(native_context()->global_object())); 2210 JSGlobalObject::cast(native_context()->global_object()));
2208 2211
2209 Handle<JSFunction> shared_array_buffer_fun = InstallFunction( 2212 Handle<JSFunction> shared_array_buffer_fun = InstallFunction(
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
3315 } 3318 }
3316 3319
3317 3320
3318 // Called when the top-level V8 mutex is destroyed. 3321 // Called when the top-level V8 mutex is destroyed.
3319 void Bootstrapper::FreeThreadResources() { 3322 void Bootstrapper::FreeThreadResources() {
3320 DCHECK(!IsActive()); 3323 DCHECK(!IsActive());
3321 } 3324 }
3322 3325
3323 } // namespace internal 3326 } // namespace internal
3324 } // namespace v8 3327 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698