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/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 if (!IsAligned(reinterpret_cast<intptr_t>(data), kPointerAlignment)) { | 28 if (!IsAligned(reinterpret_cast<intptr_t>(data), kPointerAlignment)) { |
29 byte* copy = NewArray<byte>(length); | 29 byte* copy = NewArray<byte>(length); |
30 DCHECK(IsAligned(reinterpret_cast<intptr_t>(copy), kPointerAlignment)); | 30 DCHECK(IsAligned(reinterpret_cast<intptr_t>(copy), kPointerAlignment)); |
31 CopyBytes(copy, data, length); | 31 CopyBytes(copy, data, length); |
32 data_ = copy; | 32 data_ = copy; |
33 AcquireDataOwnership(); | 33 AcquireDataOwnership(); |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 | 37 |
38 ParseInfo* ParseInfo::InitializeFromJSFunction(Handle<JSFunction> function) { | 38 ParseInfo::ParseInfo(Zone* zone) |
39 Handle<SharedFunctionInfo> shared(function->shared()); | 39 : zone_(zone), |
40 InitializeFromSharedFunctionInfo(shared); | 40 flags_(0), |
| 41 source_stream_(nullptr), |
| 42 source_stream_encoding_(ScriptCompiler::StreamedSource::ONE_BYTE), |
| 43 extension_(nullptr), |
| 44 compile_options_(ScriptCompiler::kNoCompileOptions), |
| 45 script_scope_(nullptr), |
| 46 unicode_cache_(nullptr), |
| 47 stack_limit_(0), |
| 48 hash_seed_(0), |
| 49 cached_data_(nullptr), |
| 50 ast_value_factory_(nullptr), |
| 51 literal_(nullptr), |
| 52 scope_(nullptr) {} |
| 53 |
| 54 |
| 55 ParseInfo::ParseInfo(Zone* zone, Handle<JSFunction> function) |
| 56 : ParseInfo(zone, Handle<SharedFunctionInfo>(function->shared())) { |
41 set_closure(function); | 57 set_closure(function); |
42 set_context(Handle<Context>(function->context())); | 58 set_context(Handle<Context>(function->context())); |
43 return this; | |
44 } | 59 } |
45 | 60 |
46 | 61 |
47 ParseInfo* ParseInfo::InitializeFromSharedFunctionInfo( | 62 ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared) |
48 Handle<SharedFunctionInfo> shared) { | 63 : ParseInfo(zone) { |
49 isolate_ = shared->GetIsolate(); | 64 isolate_ = shared->GetIsolate(); |
50 | 65 |
51 set_lazy(); | 66 set_lazy(); |
52 set_this_has_uses(); | 67 set_this_has_uses(); |
53 set_hash_seed(isolate_->heap()->HashSeed()); | 68 set_hash_seed(isolate_->heap()->HashSeed()); |
54 set_stack_limit(isolate_->stack_guard()->real_climit()); | 69 set_stack_limit(isolate_->stack_guard()->real_climit()); |
55 set_unicode_cache(isolate_->unicode_cache()); | 70 set_unicode_cache(isolate_->unicode_cache()); |
56 set_language_mode(shared->language_mode()); | 71 set_language_mode(shared->language_mode()); |
57 set_shared_info(shared); | 72 set_shared_info(shared); |
58 | 73 |
59 Handle<Script> script(Script::cast(shared->script())); | 74 Handle<Script> script(Script::cast(shared->script())); |
60 set_script(script); | 75 set_script(script); |
61 if (!script.is_null() && script->type()->value() == Script::TYPE_NATIVE) { | 76 if (!script.is_null() && script->type()->value() == Script::TYPE_NATIVE) { |
62 set_native(); | 77 set_native(); |
63 } | 78 } |
64 return this; | |
65 } | 79 } |
66 | 80 |
67 | 81 |
68 ParseInfo* ParseInfo::InitializeFromScript(Handle<Script> script) { | 82 ParseInfo::ParseInfo(Zone* zone, Handle<Script> script) : ParseInfo(zone) { |
69 isolate_ = script->GetIsolate(); | 83 isolate_ = script->GetIsolate(); |
70 | 84 |
71 set_this_has_uses(); | 85 set_this_has_uses(); |
72 set_hash_seed(isolate_->heap()->HashSeed()); | 86 set_hash_seed(isolate_->heap()->HashSeed()); |
73 set_stack_limit(isolate_->stack_guard()->real_climit()); | 87 set_stack_limit(isolate_->stack_guard()->real_climit()); |
74 set_unicode_cache(isolate_->unicode_cache()); | 88 set_unicode_cache(isolate_->unicode_cache()); |
75 set_script(script); | 89 set_script(script); |
76 | 90 |
77 if (script->type()->value() == Script::TYPE_NATIVE) { | 91 if (script->type()->value() == Script::TYPE_NATIVE) { |
78 set_native(); | 92 set_native(); |
79 } | 93 } |
80 return this; | |
81 } | 94 } |
82 | 95 |
83 | 96 |
84 RegExpBuilder::RegExpBuilder(Zone* zone) | 97 RegExpBuilder::RegExpBuilder(Zone* zone) |
85 : zone_(zone), | 98 : zone_(zone), |
86 pending_empty_(false), | 99 pending_empty_(false), |
87 characters_(NULL), | 100 characters_(NULL), |
88 terms_(), | 101 terms_(), |
89 alternatives_() | 102 alternatives_() |
90 #ifdef DEBUG | 103 #ifdef DEBUG |
(...skipping 5420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5511 } else { | 5524 } else { |
5512 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5525 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
5513 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5526 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
5514 raw_string->length()); | 5527 raw_string->length()); |
5515 } | 5528 } |
5516 } | 5529 } |
5517 | 5530 |
5518 return running_hash; | 5531 return running_hash; |
5519 } | 5532 } |
5520 } } // namespace v8::internal | 5533 } } // namespace v8::internal |
OLD | NEW |