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

Side by Side Diff: src/api.cc

Issue 7977001: Added ability to lock strings to prevent their representation or encoding from changing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: More tweaks. Created 9 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/handles.h » ('j') | src/heap.cc » ('J')
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 // 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 4458 matching lines...) Expand 10 before | Expand all | Expand 10 after
4469 i::Handle<i::String> obj = Utils::OpenHandle(this); 4469 i::Handle<i::String> obj = Utils::OpenHandle(this);
4470 i::Isolate* isolate = obj->GetIsolate(); 4470 i::Isolate* isolate = obj->GetIsolate();
4471 if (IsDeadCheck(isolate, "v8::String::MakeExternal()")) return false; 4471 if (IsDeadCheck(isolate, "v8::String::MakeExternal()")) return false;
4472 if (i::StringShape(*obj).IsExternalTwoByte()) { 4472 if (i::StringShape(*obj).IsExternalTwoByte()) {
4473 return false; // Already an external string. 4473 return false; // Already an external string.
4474 } 4474 }
4475 ENTER_V8(isolate); 4475 ENTER_V8(isolate);
4476 if (isolate->string_tracker()->IsFreshUnusedString(obj)) { 4476 if (isolate->string_tracker()->IsFreshUnusedString(obj)) {
4477 return false; 4477 return false;
4478 } 4478 }
4479 if (isolate->heap()->IsStringLocked(*obj)) {
4480 return false;
4481 }
4479 if (isolate->heap()->IsInGCPostProcessing()) { 4482 if (isolate->heap()->IsInGCPostProcessing()) {
4480 return false; 4483 return false;
4481 } 4484 }
4482 bool result = obj->MakeExternal(resource); 4485 bool result = obj->MakeExternal(resource);
4483 if (result && !obj->IsSymbol()) { 4486 if (result && !obj->IsSymbol()) {
4484 isolate->heap()->external_string_table()->AddString(*obj); 4487 isolate->heap()->external_string_table()->AddString(*obj);
4485 } 4488 }
4486 return result; 4489 return result;
4487 } 4490 }
4488 4491
(...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after
6077 6080
6078 6081
6079 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 6082 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
6080 HandleScopeImplementer* scope_implementer = 6083 HandleScopeImplementer* scope_implementer =
6081 reinterpret_cast<HandleScopeImplementer*>(storage); 6084 reinterpret_cast<HandleScopeImplementer*>(storage);
6082 scope_implementer->IterateThis(v); 6085 scope_implementer->IterateThis(v);
6083 return storage + ArchiveSpacePerThread(); 6086 return storage + ArchiveSpacePerThread();
6084 } 6087 }
6085 6088
6086 } } // namespace v8::internal 6089 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/handles.h » ('j') | src/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698