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

Side by Side Diff: src/stub-cache.cc

Issue 12210083: Renamed "symbols" to "internalized strings" throughout the code base, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Yang's comments Created 7 years, 10 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/string-stream.cc ('k') | src/type-info.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 58
59 Code* StubCache::Set(String* name, Map* map, Code* code) { 59 Code* StubCache::Set(String* name, Map* map, Code* code) {
60 // Get the flags from the code. 60 // Get the flags from the code.
61 Code::Flags flags = Code::RemoveTypeFromFlags(code->flags()); 61 Code::Flags flags = Code::RemoveTypeFromFlags(code->flags());
62 62
63 // Validate that the name does not move on scavenge, and that we 63 // Validate that the name does not move on scavenge, and that we
64 // can use identity checks instead of string equality checks. 64 // can use identity checks instead of string equality checks.
65 ASSERT(!heap()->InNewSpace(name)); 65 ASSERT(!heap()->InNewSpace(name));
66 ASSERT(name->IsSymbol()); 66 ASSERT(name->IsInternalizedString());
67 67
68 // The state bits are not important to the hash function because 68 // The state bits are not important to the hash function because
69 // the stub cache only contains monomorphic stubs. Make sure that 69 // the stub cache only contains monomorphic stubs. Make sure that
70 // the bits are the least significant so they will be the ones 70 // the bits are the least significant so they will be the ones
71 // masked out. 71 // masked out.
72 ASSERT(Code::ExtractICStateFromFlags(flags) == MONOMORPHIC); 72 ASSERT(Code::ExtractICStateFromFlags(flags) == MONOMORPHIC);
73 STATIC_ASSERT((Code::ICStateField::kMask & 1) == 1); 73 STATIC_ASSERT((Code::ICStateField::kMask & 1) == 1);
74 74
75 // Make sure that the code type is not included in the hash. 75 // Make sure that the code type is not included in the hash.
76 ASSERT(Code::ExtractTypeFromFlags(flags) == 0); 76 ASSERT(Code::ExtractTypeFromFlags(flags) == 0);
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); 393 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
394 JSObject::UpdateMapCodeCache(receiver, name, code); 394 JSObject::UpdateMapCodeCache(receiver, name, code);
395 return code; 395 return code;
396 } 396 }
397 397
398 398
399 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) { 399 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) {
400 Code::Flags flags = 400 Code::Flags flags =
401 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::NORMAL); 401 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::NORMAL);
402 Handle<String> name = 402 Handle<String> name =
403 isolate()->factory()->KeyedLoadElementMonomorphic_symbol(); 403 isolate()->factory()->KeyedLoadElementMonomorphic_string();
404 404
405 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_); 405 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_);
406 if (probe->IsCode()) return Handle<Code>::cast(probe); 406 if (probe->IsCode()) return Handle<Code>::cast(probe);
407 407
408 KeyedLoadStubCompiler compiler(isolate()); 408 KeyedLoadStubCompiler compiler(isolate());
409 Handle<Code> code = compiler.CompileLoadElement(receiver_map); 409 Handle<Code> code = compiler.CompileLoadElement(receiver_map);
410 410
411 PROFILE(isolate(), CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, 0)); 411 PROFILE(isolate(), CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, 0));
412 Map::UpdateCodeCache(receiver_map, name, code); 412 Map::UpdateCodeCache(receiver_map, name, code);
413 return code; 413 return code;
414 } 414 }
415 415
416 416
417 Handle<Code> StubCache::ComputeKeyedStoreElement( 417 Handle<Code> StubCache::ComputeKeyedStoreElement(
418 Handle<Map> receiver_map, 418 Handle<Map> receiver_map,
419 KeyedStoreIC::StubKind stub_kind, 419 KeyedStoreIC::StubKind stub_kind,
420 StrictModeFlag strict_mode, 420 StrictModeFlag strict_mode,
421 KeyedAccessGrowMode grow_mode) { 421 KeyedAccessGrowMode grow_mode) {
422 Code::ExtraICState extra_state = 422 Code::ExtraICState extra_state =
423 Code::ComputeExtraICState(grow_mode, strict_mode); 423 Code::ComputeExtraICState(grow_mode, strict_mode);
424 Code::Flags flags = Code::ComputeMonomorphicFlags( 424 Code::Flags flags = Code::ComputeMonomorphicFlags(
425 Code::KEYED_STORE_IC, Code::NORMAL, extra_state); 425 Code::KEYED_STORE_IC, Code::NORMAL, extra_state);
426 426
427 ASSERT(stub_kind == KeyedStoreIC::STORE_NO_TRANSITION || 427 ASSERT(stub_kind == KeyedStoreIC::STORE_NO_TRANSITION ||
428 stub_kind == KeyedStoreIC::STORE_AND_GROW_NO_TRANSITION); 428 stub_kind == KeyedStoreIC::STORE_AND_GROW_NO_TRANSITION);
429 429
430 Handle<String> name = stub_kind == KeyedStoreIC::STORE_NO_TRANSITION 430 Handle<String> name = stub_kind == KeyedStoreIC::STORE_NO_TRANSITION
431 ? isolate()->factory()->KeyedStoreElementMonomorphic_symbol() 431 ? isolate()->factory()->KeyedStoreElementMonomorphic_string()
432 : isolate()->factory()->KeyedStoreAndGrowElementMonomorphic_symbol(); 432 : isolate()->factory()->KeyedStoreAndGrowElementMonomorphic_string();
433 433
434 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_); 434 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_);
435 if (probe->IsCode()) return Handle<Code>::cast(probe); 435 if (probe->IsCode()) return Handle<Code>::cast(probe);
436 436
437 KeyedStoreStubCompiler compiler(isolate(), strict_mode, grow_mode); 437 KeyedStoreStubCompiler compiler(isolate(), strict_mode, grow_mode);
438 Handle<Code> code = compiler.CompileStoreElement(receiver_map); 438 Handle<Code> code = compiler.CompileStoreElement(receiver_map);
439 439
440 PROFILE(isolate(), CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, 0)); 440 PROFILE(isolate(), CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, 0));
441 Map::UpdateCodeCache(receiver_map, name, code); 441 Map::UpdateCodeCache(receiver_map, name, code);
442 return code; 442 return code;
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 Handle<FunctionTemplateInfo>( 1754 Handle<FunctionTemplateInfo>(
1755 FunctionTemplateInfo::cast(signature->receiver())); 1755 FunctionTemplateInfo::cast(signature->receiver()));
1756 } 1756 }
1757 } 1757 }
1758 1758
1759 is_simple_api_call_ = true; 1759 is_simple_api_call_ = true;
1760 } 1760 }
1761 1761
1762 1762
1763 } } // namespace v8::internal 1763 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/string-stream.cc ('k') | src/type-info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698