OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
(...skipping 3367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3378 void *peer); | 3378 void *peer); |
3379 | 3379 |
3380 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object); | 3380 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object); |
3381 friend class Class; | 3381 friend class Class; |
3382 }; | 3382 }; |
3383 | 3383 |
3384 | 3384 |
3385 class Script : public Object { | 3385 class Script : public Object { |
3386 public: | 3386 public: |
3387 RawString* url() const { return raw_ptr()->url_; } | 3387 RawString* url() const { return raw_ptr()->url_; } |
| 3388 |
| 3389 // The actual url which was loaded from disk, if provided by the embedder. |
| 3390 RawString* resolved_url() const { return raw_ptr()->resolved_url_; } |
3388 bool HasSource() const; | 3391 bool HasSource() const; |
3389 RawString* Source() const; | 3392 RawString* Source() const; |
3390 RawString* GenerateSource() const; // Generates source code from Tokenstream. | 3393 RawString* GenerateSource() const; // Generates source code from Tokenstream. |
3391 RawGrowableObjectArray* GenerateLineNumberArray() const; | 3394 RawGrowableObjectArray* GenerateLineNumberArray() const; |
3392 RawScript::Kind kind() const { | 3395 RawScript::Kind kind() const { |
3393 return static_cast<RawScript::Kind>(raw_ptr()->kind_); | 3396 return static_cast<RawScript::Kind>(raw_ptr()->kind_); |
3394 } | 3397 } |
3395 const char* GetKindAsCString() const; | 3398 const char* GetKindAsCString() const; |
3396 intptr_t line_offset() const { return raw_ptr()->line_offset_; } | 3399 intptr_t line_offset() const { return raw_ptr()->line_offset_; } |
3397 intptr_t col_offset() const { return raw_ptr()->col_offset_; } | 3400 intptr_t col_offset() const { return raw_ptr()->col_offset_; } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3433 TokenPosition* last_token_index) const; | 3436 TokenPosition* last_token_index) const; |
3434 | 3437 |
3435 static intptr_t InstanceSize() { | 3438 static intptr_t InstanceSize() { |
3436 return RoundedAllocationSize(sizeof(RawScript)); | 3439 return RoundedAllocationSize(sizeof(RawScript)); |
3437 } | 3440 } |
3438 | 3441 |
3439 static RawScript* New(const String& url, | 3442 static RawScript* New(const String& url, |
3440 const String& source, | 3443 const String& source, |
3441 RawScript::Kind kind); | 3444 RawScript::Kind kind); |
3442 | 3445 |
| 3446 static RawScript* New(const String& url, |
| 3447 const String& resolved_url, |
| 3448 const String& source, |
| 3449 RawScript::Kind kind); |
| 3450 |
3443 private: | 3451 private: |
3444 void set_url(const String& value) const; | 3452 void set_url(const String& value) const; |
| 3453 void set_resolved_url(const String& value) const; |
3445 void set_source(const String& value) const; | 3454 void set_source(const String& value) const; |
3446 void set_kind(RawScript::Kind value) const; | 3455 void set_kind(RawScript::Kind value) const; |
3447 void set_load_timestamp(int64_t value) const; | 3456 void set_load_timestamp(int64_t value) const; |
3448 void set_tokens(const TokenStream& value) const; | 3457 void set_tokens(const TokenStream& value) const; |
3449 | 3458 |
3450 static RawScript* New(); | 3459 static RawScript* New(); |
3451 | 3460 |
3452 FINAL_HEAP_OBJECT_IMPLEMENTATION(Script, Object); | 3461 FINAL_HEAP_OBJECT_IMPLEMENTATION(Script, Object); |
3453 friend class Class; | 3462 friend class Class; |
3454 friend class Precompiler; | 3463 friend class Precompiler; |
(...skipping 5246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8701 | 8710 |
8702 inline void TypeArguments::SetHash(intptr_t value) const { | 8711 inline void TypeArguments::SetHash(intptr_t value) const { |
8703 // This is only safe because we create a new Smi, which does not cause | 8712 // This is only safe because we create a new Smi, which does not cause |
8704 // heap allocation. | 8713 // heap allocation. |
8705 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8714 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
8706 } | 8715 } |
8707 | 8716 |
8708 } // namespace dart | 8717 } // namespace dart |
8709 | 8718 |
8710 #endif // VM_OBJECT_H_ | 8719 #endif // VM_OBJECT_H_ |
OLD | NEW |