OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/compiler-dispatcher/compiler-dispatcher-job.h" | 5 #include "src/compiler-dispatcher/compiler-dispatcher-job.h" |
6 | 6 |
7 #include "src/assert-scope.h" | 7 #include "src/assert-scope.h" |
8 #include "src/compilation-info.h" | 8 #include "src/compilation-info.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/global-handles.h" | 10 #include "src/global-handles.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); | 46 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); |
47 DCHECK(status() == CompileJobStatus::kInitial); | 47 DCHECK(status() == CompileJobStatus::kInitial); |
48 HandleScope scope(isolate_); | 48 HandleScope scope(isolate_); |
49 unicode_cache_.reset(new UnicodeCache()); | 49 unicode_cache_.reset(new UnicodeCache()); |
50 zone_.reset(new Zone(isolate_->allocator())); | 50 zone_.reset(new Zone(isolate_->allocator())); |
51 Handle<SharedFunctionInfo> shared(function_->shared(), isolate_); | 51 Handle<SharedFunctionInfo> shared(function_->shared(), isolate_); |
52 Handle<Script> script(Script::cast(shared->script()), isolate_); | 52 Handle<Script> script(Script::cast(shared->script()), isolate_); |
53 DCHECK(script->type() != Script::TYPE_NATIVE); | 53 DCHECK(script->type() != Script::TYPE_NATIVE); |
54 | 54 |
55 Handle<String> source(String::cast(script->source()), isolate_); | 55 Handle<String> source(String::cast(script->source()), isolate_); |
56 if (source->IsExternalTwoByteString()) { | 56 if (source->IsExternalTwoByteString() || source->IsExternalOneByteString()) { |
57 character_stream_.reset(new ExternalTwoByteStringUtf16CharacterStream( | 57 character_stream_.reset(ScannerStream::For(source, shared->start_position(), |
58 Handle<ExternalTwoByteString>::cast(source), shared->start_position(), | 58 shared->end_position())); |
59 shared->end_position())); | |
60 } else if (source->IsExternalOneByteString()) { | |
61 character_stream_.reset(new ExternalOneByteStringUtf16CharacterStream( | |
62 Handle<ExternalOneByteString>::cast(source), shared->start_position(), | |
63 shared->end_position())); | |
64 } else { | 59 } else { |
65 source = String::Flatten(source); | 60 source = String::Flatten(source); |
66 // Have to globalize the reference here, so it survives between function | 61 // Have to globalize the reference here, so it survives between function |
67 // calls. | 62 // calls. |
68 source_ = Handle<String>::cast(isolate_->global_handles()->Create(*source)); | 63 source_ = Handle<String>::cast(isolate_->global_handles()->Create(*source)); |
69 character_stream_.reset(new GenericStringUtf16CharacterStream( | 64 character_stream_.reset(ScannerStream::For( |
70 source_, shared->start_position(), shared->end_position())); | 65 source_, shared->start_position(), shared->end_position())); |
71 } | 66 } |
72 parse_info_.reset(new ParseInfo(zone_.get())); | 67 parse_info_.reset(new ParseInfo(zone_.get())); |
73 parse_info_->set_isolate(isolate_); | 68 parse_info_->set_isolate(isolate_); |
74 parse_info_->set_character_stream(character_stream_.get()); | 69 parse_info_->set_character_stream(character_stream_.get()); |
75 parse_info_->set_lazy(); | 70 parse_info_->set_lazy(); |
76 parse_info_->set_hash_seed(isolate_->heap()->HashSeed()); | 71 parse_info_->set_hash_seed(isolate_->heap()->HashSeed()); |
77 parse_info_->set_is_named_expression(shared->is_named_expression()); | 72 parse_info_->set_is_named_expression(shared->is_named_expression()); |
78 parse_info_->set_calls_eval(shared->scope_info()->CallsEval()); | 73 parse_info_->set_calls_eval(shared->scope_info()->CallsEval()); |
79 parse_info_->set_compiler_hints(shared->compiler_hints()); | 74 parse_info_->set_compiler_hints(shared->compiler_hints()); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 if (!source_.is_null()) { | 250 if (!source_.is_null()) { |
256 i::GlobalHandles::Destroy(Handle<Object>::cast(source_).location()); | 251 i::GlobalHandles::Destroy(Handle<Object>::cast(source_).location()); |
257 source_ = Handle<String>::null(); | 252 source_ = Handle<String>::null(); |
258 } | 253 } |
259 | 254 |
260 status_ = CompileJobStatus::kInitial; | 255 status_ = CompileJobStatus::kInitial; |
261 } | 256 } |
262 | 257 |
263 } // namespace internal | 258 } // namespace internal |
264 } // namespace v8 | 259 } // namespace v8 |
OLD | NEW |