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

Side by Side Diff: src/api.cc

Issue 11315004: Count external string resources that were assigned to symbol strings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: with minor test fix Created 8 years, 1 month 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 | test/cctest/test-api.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 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 4882 matching lines...) Expand 10 before | Expand all | Expand 10 after
4893 } 4893 }
4894 ENTER_V8(isolate); 4894 ENTER_V8(isolate);
4895 if (isolate->string_tracker()->IsFreshUnusedString(obj)) { 4895 if (isolate->string_tracker()->IsFreshUnusedString(obj)) {
4896 return false; 4896 return false;
4897 } 4897 }
4898 if (isolate->heap()->IsInGCPostProcessing()) { 4898 if (isolate->heap()->IsInGCPostProcessing()) {
4899 return false; 4899 return false;
4900 } 4900 }
4901 CHECK(resource && resource->data()); 4901 CHECK(resource && resource->data());
4902 bool result = obj->MakeExternal(resource); 4902 bool result = obj->MakeExternal(resource);
4903 if (result && !obj->IsSymbol()) { 4903 if (result) {
4904 isolate->heap()->external_string_table()->AddString(*obj); 4904 isolate->heap()->external_string_table()->AddString(*obj);
4905 } 4905 }
4906 return result; 4906 return result;
4907 } 4907 }
4908 4908
4909 4909
4910 Local<String> v8::String::NewExternal( 4910 Local<String> v8::String::NewExternal(
4911 v8::String::ExternalAsciiStringResource* resource) { 4911 v8::String::ExternalAsciiStringResource* resource) {
4912 i::Isolate* isolate = i::Isolate::Current(); 4912 i::Isolate* isolate = i::Isolate::Current();
4913 EnsureInitializedForIsolate(isolate, "v8::String::NewExternal()"); 4913 EnsureInitializedForIsolate(isolate, "v8::String::NewExternal()");
(...skipping 16 matching lines...) Expand all
4930 } 4930 }
4931 ENTER_V8(isolate); 4931 ENTER_V8(isolate);
4932 if (isolate->string_tracker()->IsFreshUnusedString(obj)) { 4932 if (isolate->string_tracker()->IsFreshUnusedString(obj)) {
4933 return false; 4933 return false;
4934 } 4934 }
4935 if (isolate->heap()->IsInGCPostProcessing()) { 4935 if (isolate->heap()->IsInGCPostProcessing()) {
4936 return false; 4936 return false;
4937 } 4937 }
4938 CHECK(resource && resource->data()); 4938 CHECK(resource && resource->data());
4939 bool result = obj->MakeExternal(resource); 4939 bool result = obj->MakeExternal(resource);
4940 if (result && !obj->IsSymbol()) { 4940 if (result) {
4941 isolate->heap()->external_string_table()->AddString(*obj); 4941 isolate->heap()->external_string_table()->AddString(*obj);
4942 } 4942 }
4943 return result; 4943 return result;
4944 } 4944 }
4945 4945
4946 4946
4947 bool v8::String::CanMakeExternal() { 4947 bool v8::String::CanMakeExternal() {
4948 if (!internal::FLAG_clever_optimizations) return false; 4948 if (!internal::FLAG_clever_optimizations) return false;
4949 i::Handle<i::String> obj = Utils::OpenHandle(this); 4949 i::Handle<i::String> obj = Utils::OpenHandle(this);
4950 i::Isolate* isolate = obj->GetIsolate(); 4950 i::Isolate* isolate = obj->GetIsolate();
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after
6639 6639
6640 v->VisitPointers(blocks_.first(), first_block_limit_); 6640 v->VisitPointers(blocks_.first(), first_block_limit_);
6641 6641
6642 for (int i = 1; i < blocks_.length(); i++) { 6642 for (int i = 1; i < blocks_.length(); i++) {
6643 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6643 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6644 } 6644 }
6645 } 6645 }
6646 6646
6647 6647
6648 } } // namespace v8::internal 6648 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698