Revision: 25159
Author: [email protected]
Date: Wed Nov 5 14:31:57 2014 UTC
Log: Revert "Parser & internalization fix: ensure no heap allocs
during GetString(Handle<String>)."
This reverts r25155.
Reason: breaks webkit unit tests.
BUG=
[email protected]
Review URL: https://codereview.chromium.org/707483002
https://code.google.com/p/v8/source/detail?r=25159
Modified:
/branches/bleeding_edge/src/ast-value-factory.cc
/branches/bleeding_edge/src/ast-value-factory.h
=======================================
--- /branches/bleeding_edge/src/ast-value-factory.cc Wed Nov 5 13:59:12
2014 UTC
+++ /branches/bleeding_edge/src/ast-value-factory.cc Wed Nov 5 14:31:57
2014 UTC
@@ -212,7 +212,7 @@
}
-AstRawString* AstValueFactory::GetOneByteStringInternal(
+const AstRawString* AstValueFactory::GetOneByteString(
Vector<const uint8_t> literal) {
uint32_t hash = StringHasher::HashSequentialString<uint8_t>(
literal.start(), literal.length(), hash_seed_);
@@ -220,7 +220,7 @@
}
-AstRawString* AstValueFactory::GetTwoByteStringInternal(
+const AstRawString* AstValueFactory::GetTwoByteString(
Vector<const uint16_t> literal) {
uint32_t hash = StringHasher::HashSequentialString<uint16_t>(
literal.start(), literal.length(), hash_seed_);
@@ -229,22 +229,13 @@
const AstRawString* AstValueFactory::GetString(Handle<String> literal) {
- // For the FlatContent to stay valid, we shouldn't do any heap
- // allocation. Make sure we won't try to internalize the string in
GetString.
- AstRawString* result = NULL;
- Isolate* saved_isolate = isolate_;
- isolate_ = NULL;
DisallowHeapAllocation no_gc;
String::FlatContent content = literal->GetFlatContent();
if (content.IsOneByte()) {
- result = GetOneByteStringInternal(content.ToOneByteVector());
- } else {
- DCHECK(content.IsTwoByte());
- result = GetTwoByteStringInternal(content.ToUC16Vector());
+ return GetOneByteString(content.ToOneByteVector());
}
- isolate_ = saved_isolate;
- result->string_ = literal;
- return result;
+ DCHECK(content.IsTwoByte());
+ return GetTwoByteString(content.ToUC16Vector());
}
@@ -357,8 +348,8 @@
#undef GENERATE_VALUE_GETTER
-AstRawString* AstValueFactory::GetString(uint32_t hash, bool is_one_byte,
- Vector<const byte> literal_bytes)
{
+const AstRawString* AstValueFactory::GetString(
+ uint32_t hash, bool is_one_byte, Vector<const byte> literal_bytes) {
// literal_bytes here points to whatever the user passed, and this is OK
// because we use vector_compare (which checks the contents) to compare
// against the AstRawStrings which are in the string_table_. We should
not
=======================================
--- /branches/bleeding_edge/src/ast-value-factory.h Wed Nov 5 13:59:12
2014 UTC
+++ /branches/bleeding_edge/src/ast-value-factory.h Wed Nov 5 14:31:57
2014 UTC
@@ -287,16 +287,12 @@
Zone* zone() const { return zone_; }
- const AstRawString* GetOneByteString(Vector<const uint8_t> literal) {
- return GetOneByteStringInternal(literal);
- }
+ const AstRawString* GetOneByteString(Vector<const uint8_t> literal);
const AstRawString* GetOneByteString(const char* string) {
return GetOneByteString(Vector<const uint8_t>(
reinterpret_cast<const uint8_t*>(string), StrLength(string)));
}
- const AstRawString* GetTwoByteString(Vector<const uint16_t> literal) {
- return GetTwoByteStringInternal(literal);
- }
+ const AstRawString* GetTwoByteString(Vector<const uint16_t> literal);
const AstRawString* GetString(Handle<String> literal);
const AstConsString* NewConsString(const AstString* left,
const AstString* right);
@@ -331,10 +327,8 @@
const AstValue* NewTheHole();
private:
- AstRawString* GetOneByteStringInternal(Vector<const uint8_t> literal);
- AstRawString* GetTwoByteStringInternal(Vector<const uint16_t> literal);
- AstRawString* GetString(uint32_t hash, bool is_one_byte,
- Vector<const byte> literal_bytes);
+ const AstRawString* GetString(uint32_t hash, bool is_one_byte,
+ Vector<const byte> literal_bytes);
// All strings are copied here, one after another (no NULLs inbetween).
HashMap string_table_;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.