| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/ast.h" | 8 #include "src/ast.h" |
| 9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Only call immediately after adding an atom or character! | 175 // Only call immediately after adding an atom or character! |
| 176 UNREACHABLE(); | 176 UNREACHABLE(); |
| 177 return; | 177 return; |
| 178 } | 178 } |
| 179 terms_.Add( | 179 terms_.Add( |
| 180 new(zone()) RegExpQuantifier(min, max, quantifier_type, atom), zone()); | 180 new(zone()) RegExpQuantifier(min, max, quantifier_type, atom), zone()); |
| 181 LAST(ADD_TERM); | 181 LAST(ADD_TERM); |
| 182 } | 182 } |
| 183 | 183 |
| 184 | 184 |
| 185 ScriptData* ScriptData::New(const char* data, int length) { | 185 ScriptData* ScriptData::New(const char* data, int length, bool owns_store) { |
| 186 // The length is obviously invalid. | 186 // The length is obviously invalid. |
| 187 if (length % sizeof(unsigned) != 0) { | 187 if (length % sizeof(unsigned) != 0) { |
| 188 return NULL; | 188 return NULL; |
| 189 } | 189 } |
| 190 | 190 |
| 191 int deserialized_data_length = length / sizeof(unsigned); | 191 int deserialized_data_length = length / sizeof(unsigned); |
| 192 unsigned* deserialized_data; | 192 unsigned* deserialized_data; |
| 193 bool owns_store = reinterpret_cast<intptr_t>(data) % sizeof(unsigned) != 0; | 193 owns_store = |
| 194 owns_store || reinterpret_cast<intptr_t>(data) % sizeof(unsigned) != 0; |
| 194 if (owns_store) { | 195 if (owns_store) { |
| 195 // Copy the data to align it. | 196 // Copy the data to align it. |
| 196 deserialized_data = i::NewArray<unsigned>(deserialized_data_length); | 197 deserialized_data = i::NewArray<unsigned>(deserialized_data_length); |
| 197 i::CopyBytes(reinterpret_cast<char*>(deserialized_data), | 198 i::CopyBytes(reinterpret_cast<char*>(deserialized_data), |
| 198 data, static_cast<size_t>(length)); | 199 data, static_cast<size_t>(length)); |
| 199 } else { | 200 } else { |
| 200 // If aligned, don't create a copy of the data. | 201 // If aligned, don't create a copy of the data. |
| 201 deserialized_data = reinterpret_cast<unsigned*>(const_cast<char*>(data)); | 202 deserialized_data = reinterpret_cast<unsigned*>(const_cast<char*>(data)); |
| 202 } | 203 } |
| 203 return new ScriptData( | 204 return new ScriptData( |
| (...skipping 4662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4866 info()->SetAstValueFactory(ast_value_factory_); | 4867 info()->SetAstValueFactory(ast_value_factory_); |
| 4867 } | 4868 } |
| 4868 ast_value_factory_ = NULL; | 4869 ast_value_factory_ = NULL; |
| 4869 | 4870 |
| 4870 InternalizeUseCounts(); | 4871 InternalizeUseCounts(); |
| 4871 | 4872 |
| 4872 return (result != NULL); | 4873 return (result != NULL); |
| 4873 } | 4874 } |
| 4874 | 4875 |
| 4875 } } // namespace v8::internal | 4876 } } // namespace v8::internal |
| OLD | NEW |