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/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 408 |
409 | 409 |
410 void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) { | 410 void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) { |
411 Handle<TypeFeedbackInfo> info = isolate()->factory()->NewTypeFeedbackInfo(); | 411 Handle<TypeFeedbackInfo> info = isolate()->factory()->NewTypeFeedbackInfo(); |
412 info->set_ic_total_count(ic_total_count_); | 412 info->set_ic_total_count(ic_total_count_); |
413 DCHECK(!isolate()->heap()->InNewSpace(*info)); | 413 DCHECK(!isolate()->heap()->InNewSpace(*info)); |
414 code->set_type_feedback_info(*info); | 414 code->set_type_feedback_info(*info); |
415 } | 415 } |
416 | 416 |
417 | 417 |
| 418 bool FullCodeGenerator::MustCreateObjectLiteralWithRuntime( |
| 419 ObjectLiteral* expr) const { |
| 420 // FastCloneShallowObjectStub doesn't copy elements, and object literals don't |
| 421 // support copy-on-write (COW) elements for now. |
| 422 // TODO(mvstanton): make object literals support COW elements. |
| 423 return expr->may_store_doubles() || expr->depth() > 1 || |
| 424 masm()->serializer_enabled() || |
| 425 expr->ComputeFlags() != ObjectLiteral::kFastElements || |
| 426 expr->has_elements() || |
| 427 expr->properties_count() > |
| 428 FastCloneShallowObjectStub::kMaximumClonedProperties; |
| 429 } |
| 430 |
| 431 |
| 432 bool FullCodeGenerator::MustCreateArrayLiteralWithRuntime( |
| 433 ArrayLiteral* expr) const { |
| 434 return expr->depth() > 1 || |
| 435 expr->values()->length() > JSObject::kInitialMaxFastElementArray; |
| 436 } |
| 437 |
| 438 |
418 void FullCodeGenerator::Initialize() { | 439 void FullCodeGenerator::Initialize() { |
419 InitializeAstVisitor(info_->isolate(), info_->zone()); | 440 InitializeAstVisitor(info_->isolate(), info_->zone()); |
420 // The generation of debug code must match between the snapshot code and the | 441 // The generation of debug code must match between the snapshot code and the |
421 // code that is generated later. This is assumed by the debugger when it is | 442 // code that is generated later. This is assumed by the debugger when it is |
422 // calculating PC offsets after generating a debug version of code. Therefore | 443 // calculating PC offsets after generating a debug version of code. Therefore |
423 // we disable the production of debug code in the full compiler if we are | 444 // we disable the production of debug code in the full compiler if we are |
424 // either generating a snapshot or we booted from a snapshot. | 445 // either generating a snapshot or we booted from a snapshot. |
425 generate_debug_code_ = FLAG_debug_code && | 446 generate_debug_code_ = FLAG_debug_code && |
426 !masm_->serializer_enabled() && | 447 !masm_->serializer_enabled() && |
427 !Snapshot::HaveASnapshotToStartFrom(); | 448 !Snapshot::HaveASnapshotToStartFrom(); |
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1823 } | 1844 } |
1824 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); | 1845 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); |
1825 codegen_->scope_ = saved_scope_; | 1846 codegen_->scope_ = saved_scope_; |
1826 } | 1847 } |
1827 | 1848 |
1828 | 1849 |
1829 #undef __ | 1850 #undef __ |
1830 | 1851 |
1831 | 1852 |
1832 } } // namespace v8::internal | 1853 } } // namespace v8::internal |
OLD | NEW |