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

Side by Side Diff: src/api.cc

Issue 13496008: fix bogus uses of preparser API (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 7 years, 8 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
« no previous file with comments | « no previous file | src/parser.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 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 Utils::OpenHandle(this)->set_internal_field_count(i::Smi::FromInt(value)); 1648 Utils::OpenHandle(this)->set_internal_field_count(i::Smi::FromInt(value));
1649 } 1649 }
1650 1650
1651 1651
1652 // --- S c r i p t D a t a --- 1652 // --- S c r i p t D a t a ---
1653 1653
1654 1654
1655 ScriptData* ScriptData::PreCompile(const char* input, int length) { 1655 ScriptData* ScriptData::PreCompile(const char* input, int length) {
1656 i::Utf8ToUtf16CharacterStream stream( 1656 i::Utf8ToUtf16CharacterStream stream(
1657 reinterpret_cast<const unsigned char*>(input), length); 1657 reinterpret_cast<const unsigned char*>(input), length);
1658 return i::ParserApi::PreParse(&stream, NULL, i::FLAG_harmony_scoping); 1658 return i::ParserApi::PreParse(&stream);
1659 } 1659 }
1660 1660
1661 1661
1662 ScriptData* ScriptData::PreCompile(v8::Handle<String> source) { 1662 ScriptData* ScriptData::PreCompile(v8::Handle<String> source) {
1663 i::Handle<i::String> str = Utils::OpenHandle(*source); 1663 i::Handle<i::String> str = Utils::OpenHandle(*source);
1664 if (str->IsExternalTwoByteString()) { 1664 if (str->IsExternalTwoByteString()) {
1665 i::ExternalTwoByteStringUtf16CharacterStream stream( 1665 i::ExternalTwoByteStringUtf16CharacterStream stream(
1666 i::Handle<i::ExternalTwoByteString>::cast(str), 0, str->length()); 1666 i::Handle<i::ExternalTwoByteString>::cast(str), 0, str->length());
1667 return i::ParserApi::PreParse(&stream, NULL, i::FLAG_harmony_scoping); 1667 return i::ParserApi::PreParse(&stream);
1668 } else { 1668 } else {
1669 i::GenericStringUtf16CharacterStream stream(str, 0, str->length()); 1669 i::GenericStringUtf16CharacterStream stream(str, 0, str->length());
1670 return i::ParserApi::PreParse(&stream, NULL, i::FLAG_harmony_scoping); 1670 return i::ParserApi::PreParse(&stream);
1671 } 1671 }
1672 } 1672 }
1673 1673
1674 1674
1675 ScriptData* ScriptData::New(const char* data, int length) { 1675 ScriptData* ScriptData::New(const char* data, int length) {
1676 // Return an empty ScriptData if the length is obviously invalid. 1676 // Return an empty ScriptData if the length is obviously invalid.
1677 if (length % sizeof(unsigned) != 0) { 1677 if (length % sizeof(unsigned) != 0) {
1678 return new i::ScriptDataImpl(); 1678 return new i::ScriptDataImpl();
1679 } 1679 }
1680 1680
(...skipping 5532 matching lines...) Expand 10 before | Expand all | Expand 10 after
7213 7213
7214 v->VisitPointers(blocks_.first(), first_block_limit_); 7214 v->VisitPointers(blocks_.first(), first_block_limit_);
7215 7215
7216 for (int i = 1; i < blocks_.length(); i++) { 7216 for (int i = 1; i < blocks_.length(); i++) {
7217 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 7217 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
7218 } 7218 }
7219 } 7219 }
7220 7220
7221 7221
7222 } } // namespace v8::internal 7222 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698