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

Side by Side Diff: src/bootstrapper.cc

Issue 488073002: Further reduce LookupResult usage (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: More consistency Created 6 years, 4 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/hydrogen.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 2427 matching lines...) Expand 10 before | Expand all | Expand 10 after
2438 break; 2438 break;
2439 } 2439 }
2440 case CONSTANT: { 2440 case CONSTANT: {
2441 HandleScope inner(isolate()); 2441 HandleScope inner(isolate());
2442 Handle<Name> key = Handle<Name>(descs->GetKey(i)); 2442 Handle<Name> key = Handle<Name>(descs->GetKey(i));
2443 Handle<Object> constant(descs->GetConstant(i), isolate()); 2443 Handle<Object> constant(descs->GetConstant(i), isolate());
2444 JSObject::AddProperty(to, key, constant, details.attributes()); 2444 JSObject::AddProperty(to, key, constant, details.attributes());
2445 break; 2445 break;
2446 } 2446 }
2447 case CALLBACKS: { 2447 case CALLBACKS: {
2448 LookupResult result(isolate()); 2448 Handle<Name> key(descs->GetKey(i));
2449 Handle<Name> key(Name::cast(descs->GetKey(i)), isolate()); 2449 LookupIterator it(to, key, LookupIterator::CHECK_PROPERTY);
2450 to->LookupOwn(key, &result);
2451 // If the property is already there we skip it 2450 // If the property is already there we skip it
2452 if (result.IsFound()) continue; 2451 if (it.IsFound() && it.HasProperty()) continue;
2453 HandleScope inner(isolate()); 2452 HandleScope inner(isolate());
2454 DCHECK(!to->HasFastProperties()); 2453 DCHECK(!to->HasFastProperties());
2455 // Add to dictionary. 2454 // Add to dictionary.
2456 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate()); 2455 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate());
2457 PropertyDetails d = PropertyDetails( 2456 PropertyDetails d = PropertyDetails(
2458 details.attributes(), CALLBACKS, i + 1); 2457 details.attributes(), CALLBACKS, i + 1);
2459 JSObject::SetNormalizedProperty(to, key, callbacks, d); 2458 JSObject::SetNormalizedProperty(to, key, callbacks, d);
2460 break; 2459 break;
2461 } 2460 }
2462 case NORMAL: 2461 case NORMAL:
2463 // Do not occur since the from object has fast properties. 2462 // Do not occur since the from object has fast properties.
2464 case HANDLER: 2463 case HANDLER:
2465 case INTERCEPTOR: 2464 case INTERCEPTOR:
2466 case NONEXISTENT: 2465 case NONEXISTENT:
2467 // No element in instance descriptors have proxy or interceptor type. 2466 // No element in instance descriptors have proxy or interceptor type.
2468 UNREACHABLE(); 2467 UNREACHABLE();
2469 break; 2468 break;
2470 } 2469 }
2471 } 2470 }
2472 } else { 2471 } else {
2473 Handle<NameDictionary> properties = 2472 Handle<NameDictionary> properties =
2474 Handle<NameDictionary>(from->property_dictionary()); 2473 Handle<NameDictionary>(from->property_dictionary());
2475 int capacity = properties->Capacity(); 2474 int capacity = properties->Capacity();
2476 for (int i = 0; i < capacity; i++) { 2475 for (int i = 0; i < capacity; i++) {
2477 Object* raw_key(properties->KeyAt(i)); 2476 Object* raw_key(properties->KeyAt(i));
2478 if (properties->IsKey(raw_key)) { 2477 if (properties->IsKey(raw_key)) {
2479 DCHECK(raw_key->IsName()); 2478 DCHECK(raw_key->IsName());
2480 // If the property is already there we skip it. 2479 // If the property is already there we skip it.
2481 LookupResult result(isolate());
2482 Handle<Name> key(Name::cast(raw_key)); 2480 Handle<Name> key(Name::cast(raw_key));
2483 to->LookupOwn(key, &result); 2481 LookupIterator it(to, key, LookupIterator::CHECK_PROPERTY);
2484 if (result.IsFound()) continue; 2482 if (it.IsFound() && it.HasProperty()) continue;
2485 // Set the property. 2483 // Set the property.
2486 Handle<Object> value = Handle<Object>(properties->ValueAt(i), 2484 Handle<Object> value = Handle<Object>(properties->ValueAt(i),
2487 isolate()); 2485 isolate());
2488 DCHECK(!value->IsCell()); 2486 DCHECK(!value->IsCell());
2489 if (value->IsPropertyCell()) { 2487 if (value->IsPropertyCell()) {
2490 value = Handle<Object>(PropertyCell::cast(*value)->value(), 2488 value = Handle<Object>(PropertyCell::cast(*value)->value(),
2491 isolate()); 2489 isolate());
2492 } 2490 }
2493 PropertyDetails details = properties->DetailsAt(i); 2491 PropertyDetails details = properties->DetailsAt(i);
2494 JSObject::AddProperty(to, key, value, details.attributes()); 2492 JSObject::AddProperty(to, key, value, details.attributes());
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2691 return from + sizeof(NestingCounterType); 2689 return from + sizeof(NestingCounterType);
2692 } 2690 }
2693 2691
2694 2692
2695 // Called when the top-level V8 mutex is destroyed. 2693 // Called when the top-level V8 mutex is destroyed.
2696 void Bootstrapper::FreeThreadResources() { 2694 void Bootstrapper::FreeThreadResources() {
2697 DCHECK(!IsActive()); 2695 DCHECK(!IsActive());
2698 } 2696 }
2699 2697
2700 } } // namespace v8::internal 2698 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698