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

Side by Side Diff: src/bootstrapper.cc

Issue 536943002: Never skip access checks when looking up properties (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | src/factory.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/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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 if (js_global_object_template.is_null()) { 778 if (js_global_object_template.is_null()) {
779 Handle<String> name = Handle<String>(heap()->empty_string()); 779 Handle<String> name = Handle<String>(heap()->empty_string());
780 Handle<Code> code = Handle<Code>(isolate()->builtins()->builtin( 780 Handle<Code> code = Handle<Code>(isolate()->builtins()->builtin(
781 Builtins::kIllegal)); 781 Builtins::kIllegal));
782 Handle<JSObject> prototype = 782 Handle<JSObject> prototype =
783 factory()->NewFunctionPrototype(isolate()->object_function()); 783 factory()->NewFunctionPrototype(isolate()->object_function());
784 js_global_object_function = factory()->NewFunction( 784 js_global_object_function = factory()->NewFunction(
785 name, code, prototype, JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize); 785 name, code, prototype, JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize);
786 #ifdef DEBUG 786 #ifdef DEBUG
787 LookupIterator it(prototype, factory()->constructor_string(), 787 LookupIterator it(prototype, factory()->constructor_string(),
788 LookupIterator::OWN_PROPERTY); 788 LookupIterator::OWN_SKIP_INTERCEPTOR);
789 Handle<Object> value = JSReceiver::GetProperty(&it).ToHandleChecked(); 789 Handle<Object> value = JSReceiver::GetProperty(&it).ToHandleChecked();
790 DCHECK(it.IsFound()); 790 DCHECK(it.IsFound());
791 DCHECK_EQ(*isolate()->object_function(), *value); 791 DCHECK_EQ(*isolate()->object_function(), *value);
792 #endif 792 #endif
793 } else { 793 } else {
794 Handle<FunctionTemplateInfo> js_global_object_constructor( 794 Handle<FunctionTemplateInfo> js_global_object_constructor(
795 FunctionTemplateInfo::cast(js_global_object_template->constructor())); 795 FunctionTemplateInfo::cast(js_global_object_template->constructor()));
796 js_global_object_function = 796 js_global_object_function =
797 factory()->CreateApiFunction(js_global_object_constructor, 797 factory()->CreateApiFunction(js_global_object_constructor,
798 factory()->the_hole_value(), 798 factory()->the_hole_value(),
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after
2478 } 2478 }
2479 case CONSTANT: { 2479 case CONSTANT: {
2480 HandleScope inner(isolate()); 2480 HandleScope inner(isolate());
2481 Handle<Name> key = Handle<Name>(descs->GetKey(i)); 2481 Handle<Name> key = Handle<Name>(descs->GetKey(i));
2482 Handle<Object> constant(descs->GetConstant(i), isolate()); 2482 Handle<Object> constant(descs->GetConstant(i), isolate());
2483 JSObject::AddProperty(to, key, constant, details.attributes()); 2483 JSObject::AddProperty(to, key, constant, details.attributes());
2484 break; 2484 break;
2485 } 2485 }
2486 case CALLBACKS: { 2486 case CALLBACKS: {
2487 Handle<Name> key(descs->GetKey(i)); 2487 Handle<Name> key(descs->GetKey(i));
2488 LookupIterator it(to, key, LookupIterator::OWN_PROPERTY); 2488 LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
2489 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state());
2489 // If the property is already there we skip it 2490 // If the property is already there we skip it
2490 if (it.IsFound() && it.HasProperty()) continue; 2491 if (it.IsFound() && it.HasProperty()) continue;
2491 HandleScope inner(isolate()); 2492 HandleScope inner(isolate());
2492 DCHECK(!to->HasFastProperties()); 2493 DCHECK(!to->HasFastProperties());
2493 // Add to dictionary. 2494 // Add to dictionary.
2494 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate()); 2495 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate());
2495 PropertyDetails d = PropertyDetails( 2496 PropertyDetails d = PropertyDetails(
2496 details.attributes(), CALLBACKS, i + 1); 2497 details.attributes(), CALLBACKS, i + 1);
2497 JSObject::SetNormalizedProperty(to, key, callbacks, d); 2498 JSObject::SetNormalizedProperty(to, key, callbacks, d);
2498 break; 2499 break;
2499 } 2500 }
2500 // Do not occur since the from object has fast properties. 2501 // Do not occur since the from object has fast properties.
2501 case NORMAL: 2502 case NORMAL:
2502 UNREACHABLE(); 2503 UNREACHABLE();
2503 break; 2504 break;
2504 } 2505 }
2505 } 2506 }
2506 } else { 2507 } else {
2507 Handle<NameDictionary> properties = 2508 Handle<NameDictionary> properties =
2508 Handle<NameDictionary>(from->property_dictionary()); 2509 Handle<NameDictionary>(from->property_dictionary());
2509 int capacity = properties->Capacity(); 2510 int capacity = properties->Capacity();
2510 for (int i = 0; i < capacity; i++) { 2511 for (int i = 0; i < capacity; i++) {
2511 Object* raw_key(properties->KeyAt(i)); 2512 Object* raw_key(properties->KeyAt(i));
2512 if (properties->IsKey(raw_key)) { 2513 if (properties->IsKey(raw_key)) {
2513 DCHECK(raw_key->IsName()); 2514 DCHECK(raw_key->IsName());
2514 // If the property is already there we skip it. 2515 // If the property is already there we skip it.
2515 Handle<Name> key(Name::cast(raw_key)); 2516 Handle<Name> key(Name::cast(raw_key));
2516 LookupIterator it(to, key, LookupIterator::OWN_PROPERTY); 2517 LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
2518 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state());
2517 if (it.IsFound() && it.HasProperty()) continue; 2519 if (it.IsFound() && it.HasProperty()) continue;
2518 // Set the property. 2520 // Set the property.
2519 Handle<Object> value = Handle<Object>(properties->ValueAt(i), 2521 Handle<Object> value = Handle<Object>(properties->ValueAt(i),
2520 isolate()); 2522 isolate());
2521 DCHECK(!value->IsCell()); 2523 DCHECK(!value->IsCell());
2522 if (value->IsPropertyCell()) { 2524 if (value->IsPropertyCell()) {
2523 value = Handle<Object>(PropertyCell::cast(*value)->value(), 2525 value = Handle<Object>(PropertyCell::cast(*value)->value(),
2524 isolate()); 2526 isolate());
2525 } 2527 }
2526 PropertyDetails details = properties->DetailsAt(i); 2528 PropertyDetails details = properties->DetailsAt(i);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 return from + sizeof(NestingCounterType); 2726 return from + sizeof(NestingCounterType);
2725 } 2727 }
2726 2728
2727 2729
2728 // Called when the top-level V8 mutex is destroyed. 2730 // Called when the top-level V8 mutex is destroyed.
2729 void Bootstrapper::FreeThreadResources() { 2731 void Bootstrapper::FreeThreadResources() {
2730 DCHECK(!IsActive()); 2732 DCHECK(!IsActive());
2731 } 2733 }
2732 2734
2733 } } // namespace v8::internal 2735 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698