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

Side by Side Diff: src/api.cc

Issue 10917065: Fix more windows build warnings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | 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 4925 matching lines...) Expand 10 before | Expand all | Expand 10 after
4936 4936
4937 Local<String> v8::String::NewExternal(ExternalLatin1StringResource* resource, 4937 Local<String> v8::String::NewExternal(ExternalLatin1StringResource* resource,
4938 int encoding) { 4938 int encoding) {
4939 typedef v8::internal::Internals I; 4939 typedef v8::internal::Internals I;
4940 i::Isolate* isolate = i::Isolate::Current(); 4940 i::Isolate* isolate = i::Isolate::Current();
4941 EnsureInitializedForIsolate(isolate, "v8::String::NewExternal()"); 4941 EnsureInitializedForIsolate(isolate, "v8::String::NewExternal()");
4942 LOG_API(isolate, "String::NewExternal"); 4942 LOG_API(isolate, "String::NewExternal");
4943 ENTER_V8(isolate); 4943 ENTER_V8(isolate);
4944 ASSERT((encoding & kStringEncodingMask) == LATIN1_ENCODING); 4944 ASSERT((encoding & kStringEncodingMask) == LATIN1_ENCODING);
4945 CHECK(resource && resource->data()); 4945 CHECK(resource && resource->data());
4946 bool ascii_hint = (encoding & kAsciiHintMask); 4946 int ascii_hint = (encoding & kAsciiHintMask);
4947 i::Handle<i::String> result; 4947 i::Handle<i::String> result;
4948 4948
4949 if (ascii_hint == ASCII_HINT || 4949 if (ascii_hint == ASCII_HINT ||
4950 (ascii_hint != NOT_ASCII_HINT && 4950 (ascii_hint != NOT_ASCII_HINT &&
4951 i::String::IsAscii(resource->data(), resource->length()))) { 4951 i::String::IsAscii(resource->data(),
4952 static_cast<int>(resource->length())))) {
4952 // Assert that the ascii hint is correct. 4953 // Assert that the ascii hint is correct.
4953 ASSERT(ascii_hint != ASCII_HINT || 4954 ASSERT(ascii_hint != ASCII_HINT ||
4954 i::String::IsAscii(resource->data(), resource->length())); 4955 i::String::IsAscii(resource->data(),
4956 static_cast<int>(resource->length())));
4955 result = NewExternalAsciiStringHandle(isolate, resource); 4957 result = NewExternalAsciiStringHandle(isolate, resource);
4956 isolate->heap()->external_string_table()->AddString(*result); 4958 isolate->heap()->external_string_table()->AddString(*result);
4957 } else { 4959 } else {
4958 // We cannot simply take the backing store and use it as an ASCII string, 4960 // We cannot simply take the backing store and use it as an ASCII string,
4959 // since it's not. Instead, we convert it to an internal string and dispose 4961 // since it's not. Instead, we convert it to an internal string and dispose
4960 // the external resource. 4962 // the external resource.
4961 result = isolate->factory()->NewStringFromLatin1( 4963 result = isolate->factory()->NewStringFromLatin1(
4962 i::Vector<const char>(resource->data(), resource->length()), 4964 i::Vector<const char>(resource->data(),
4965 static_cast<int>(resource->length())),
4963 i::NOT_TENURED, 4966 i::NOT_TENURED,
4964 i::String::NOT_ASCII); 4967 i::String::NOT_ASCII);
4965 resource->Dispose(); 4968 resource->Dispose();
4966 } 4969 }
4967 return Utils::ToLocal(result); 4970 return Utils::ToLocal(result);
4968 } 4971 }
4969 4972
4970 4973
4971 bool v8::String::CanMakeExternal() { 4974 bool v8::String::CanMakeExternal() {
4972 if (!internal::FLAG_clever_optimizations) return false; 4975 if (!internal::FLAG_clever_optimizations) return false;
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
6651 6654
6652 v->VisitPointers(blocks_.first(), first_block_limit_); 6655 v->VisitPointers(blocks_.first(), first_block_limit_);
6653 6656
6654 for (int i = 1; i < blocks_.length(); i++) { 6657 for (int i = 1; i < blocks_.length(); i++) {
6655 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6658 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6656 } 6659 }
6657 } 6660 }
6658 6661
6659 6662
6660 } } // namespace v8::internal 6663 } } // 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