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

Side by Side Diff: src/scopeinfo.cc

Issue 265553003: StringTable::Lookup*IfExist() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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/objects.cc ('k') | 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include "v8.h" 7 #include "v8.h"
8 8
9 #include "scopeinfo.h" 9 #include "scopeinfo.h"
10 #include "scopes.h" 10 #include "scopes.h"
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 } 429 }
430 return kNotFound; 430 return kNotFound;
431 } 431 }
432 432
433 433
434 void ContextSlotCache::Update(Handle<Object> data, 434 void ContextSlotCache::Update(Handle<Object> data,
435 Handle<String> name, 435 Handle<String> name,
436 VariableMode mode, 436 VariableMode mode,
437 InitializationFlag init_flag, 437 InitializationFlag init_flag,
438 int slot_index) { 438 int slot_index) {
439 String* internalized_name; 439 Handle<String> internalized_name;
440 ASSERT(slot_index > kNotFound); 440 ASSERT(slot_index > kNotFound);
441 if (name->GetIsolate()->heap()->InternalizeStringIfExists( 441 if (StringTable::InternalizeStringIfExists(name->GetIsolate(), name).
442 *name, &internalized_name)) { 442 ToHandle(&internalized_name)) {
443 int index = Hash(*data, internalized_name); 443 int index = Hash(*data, *internalized_name);
444 Key& key = keys_[index]; 444 Key& key = keys_[index];
445 key.data = *data; 445 key.data = *data;
446 key.name = internalized_name; 446 key.name = *internalized_name;
447 // Please note value only takes a uint as index. 447 // Please note value only takes a uint as index.
448 values_[index] = Value(mode, init_flag, slot_index - kNotFound).raw(); 448 values_[index] = Value(mode, init_flag, slot_index - kNotFound).raw();
449 #ifdef DEBUG 449 #ifdef DEBUG
450 ValidateEntry(data, name, mode, init_flag, slot_index); 450 ValidateEntry(data, name, mode, init_flag, slot_index);
451 #endif 451 #endif
452 } 452 }
453 } 453 }
454 454
455 455
456 void ContextSlotCache::Clear() { 456 void ContextSlotCache::Clear() {
457 for (int index = 0; index < kLength; index++) keys_[index].data = NULL; 457 for (int index = 0; index < kLength; index++) keys_[index].data = NULL;
458 } 458 }
459 459
460 460
461 #ifdef DEBUG 461 #ifdef DEBUG
462 462
463 void ContextSlotCache::ValidateEntry(Handle<Object> data, 463 void ContextSlotCache::ValidateEntry(Handle<Object> data,
464 Handle<String> name, 464 Handle<String> name,
465 VariableMode mode, 465 VariableMode mode,
466 InitializationFlag init_flag, 466 InitializationFlag init_flag,
467 int slot_index) { 467 int slot_index) {
468 String* internalized_name; 468 Handle<String> internalized_name;
469 if (name->GetIsolate()->heap()->InternalizeStringIfExists( 469 if (StringTable::InternalizeStringIfExists(name->GetIsolate(), name).
470 *name, &internalized_name)) { 470 ToHandle(&internalized_name)) {
471 int index = Hash(*data, *name); 471 int index = Hash(*data, *name);
472 Key& key = keys_[index]; 472 Key& key = keys_[index];
473 ASSERT(key.data == *data); 473 ASSERT(key.data == *data);
474 ASSERT(key.name->Equals(*name)); 474 ASSERT(key.name->Equals(*name));
475 Value result(values_[index]); 475 Value result(values_[index]);
476 ASSERT(result.mode() == mode); 476 ASSERT(result.mode() == mode);
477 ASSERT(result.initialization_flag() == init_flag); 477 ASSERT(result.initialization_flag() == init_flag);
478 ASSERT(result.index() + kNotFound == slot_index); 478 ASSERT(result.index() + kNotFound == slot_index);
479 } 479 }
480 } 480 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 } else { 548 } else {
549 ASSERT(var->index() >= 0); 549 ASSERT(var->index() >= 0);
550 info->set_index(i, var->index()); 550 info->set_index(i, var->index());
551 } 551 }
552 } 552 }
553 ASSERT(i == info->length()); 553 ASSERT(i == info->length());
554 return info; 554 return info;
555 } 555 }
556 556
557 } } // namespace v8::internal 557 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698