Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: src/hydrogen.cc

Issue 12957004: ES6 symbols: turn symbols into a proper primitive type (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.h ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5071 matching lines...) Expand 10 before | Expand all | Expand 10 after
5082 HHasInstanceTypeAndBranch* typecheck = 5082 HHasInstanceTypeAndBranch* typecheck =
5083 new(zone()) HHasInstanceTypeAndBranch(return_value, 5083 new(zone()) HHasInstanceTypeAndBranch(return_value,
5084 FIRST_SPEC_OBJECT_TYPE, 5084 FIRST_SPEC_OBJECT_TYPE,
5085 LAST_SPEC_OBJECT_TYPE); 5085 LAST_SPEC_OBJECT_TYPE);
5086 HBasicBlock* if_spec_object = graph()->CreateBasicBlock(); 5086 HBasicBlock* if_spec_object = graph()->CreateBasicBlock();
5087 HBasicBlock* not_spec_object = graph()->CreateBasicBlock(); 5087 HBasicBlock* not_spec_object = graph()->CreateBasicBlock();
5088 typecheck->SetSuccessorAt(0, if_spec_object); 5088 typecheck->SetSuccessorAt(0, if_spec_object);
5089 typecheck->SetSuccessorAt(1, not_spec_object); 5089 typecheck->SetSuccessorAt(1, not_spec_object);
5090 current_block()->Finish(typecheck); 5090 current_block()->Finish(typecheck);
5091 if_spec_object->AddLeaveInlined(return_value, state); 5091 if_spec_object->AddLeaveInlined(return_value, state);
5092 if (!FLAG_harmony_symbols) { 5092 not_spec_object->AddLeaveInlined(receiver, state);
5093 not_spec_object->AddLeaveInlined(receiver, state);
5094 } else {
5095 HHasInstanceTypeAndBranch* symbolcheck =
5096 new(zone()) HHasInstanceTypeAndBranch(return_value, SYMBOL_TYPE);
5097 HBasicBlock* is_symbol = graph()->CreateBasicBlock();
5098 HBasicBlock* not_symbol = graph()->CreateBasicBlock();
5099 symbolcheck->SetSuccessorAt(0, is_symbol);
5100 symbolcheck->SetSuccessorAt(1, not_symbol);
5101 not_spec_object->Finish(symbolcheck);
5102 is_symbol->AddLeaveInlined(return_value, state);
5103 not_symbol->AddLeaveInlined(receiver, state);
5104 }
5105 } 5093 }
5106 } else if (state->inlining_kind() == SETTER_CALL_RETURN) { 5094 } else if (state->inlining_kind() == SETTER_CALL_RETURN) {
5107 // Return from an inlined setter call. The returned value is never used, the 5095 // Return from an inlined setter call. The returned value is never used, the
5108 // value of an assignment is always the value of the RHS of the assignment. 5096 // value of an assignment is always the value of the RHS of the assignment.
5109 CHECK_ALIVE(VisitForEffect(stmt->expression())); 5097 CHECK_ALIVE(VisitForEffect(stmt->expression()));
5110 if (context->IsTest()) { 5098 if (context->IsTest()) {
5111 HValue* rhs = environment()->arguments_environment()->Lookup(1); 5099 HValue* rhs = environment()->arguments_environment()->Lookup(1);
5112 context->ReturnValue(rhs); 5100 context->ReturnValue(rhs);
5113 } else if (context->IsEffect()) { 5101 } else if (context->IsEffect()) {
5114 current_block()->Goto(function_return(), state); 5102 current_block()->Goto(function_return(), state);
(...skipping 4964 matching lines...) Expand 10 before | Expand all | Expand 10 after
10079 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 10067 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
10080 HValue* value = Pop(); 10068 HValue* value = Pop();
10081 HHasInstanceTypeAndBranch* result = 10069 HHasInstanceTypeAndBranch* result =
10082 new(zone()) HHasInstanceTypeAndBranch(value, 10070 new(zone()) HHasInstanceTypeAndBranch(value,
10083 FIRST_SPEC_OBJECT_TYPE, 10071 FIRST_SPEC_OBJECT_TYPE,
10084 LAST_SPEC_OBJECT_TYPE); 10072 LAST_SPEC_OBJECT_TYPE);
10085 return ast_context()->ReturnControl(result, call->id()); 10073 return ast_context()->ReturnControl(result, call->id());
10086 } 10074 }
10087 10075
10088 10076
10089 void HOptimizedGraphBuilder::GenerateIsSymbol(CallRuntime* call) {
10090 ASSERT(call->arguments()->length() == 1);
10091 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
10092 HValue* value = Pop();
10093 HHasInstanceTypeAndBranch* result =
10094 new(zone()) HHasInstanceTypeAndBranch(value, SYMBOL_TYPE);
10095 return ast_context()->ReturnControl(result, call->id());
10096 }
10097
10098
10099 void HOptimizedGraphBuilder::GenerateIsFunction(CallRuntime* call) { 10077 void HOptimizedGraphBuilder::GenerateIsFunction(CallRuntime* call) {
10100 ASSERT(call->arguments()->length() == 1); 10078 ASSERT(call->arguments()->length() == 1);
10101 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 10079 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
10102 HValue* value = Pop(); 10080 HValue* value = Pop();
10103 HHasInstanceTypeAndBranch* result = 10081 HHasInstanceTypeAndBranch* result =
10104 new(zone()) HHasInstanceTypeAndBranch(value, JS_FUNCTION_TYPE); 10082 new(zone()) HHasInstanceTypeAndBranch(value, JS_FUNCTION_TYPE);
10105 return ast_context()->ReturnControl(result, call->id()); 10083 return ast_context()->ReturnControl(result, call->id());
10106 } 10084 }
10107 10085
10108 10086
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
11263 } 11241 }
11264 } 11242 }
11265 11243
11266 #ifdef DEBUG 11244 #ifdef DEBUG
11267 if (graph_ != NULL) graph_->Verify(false); // No full verify. 11245 if (graph_ != NULL) graph_->Verify(false); // No full verify.
11268 if (allocator_ != NULL) allocator_->Verify(); 11246 if (allocator_ != NULL) allocator_->Verify();
11269 #endif 11247 #endif
11270 } 11248 }
11271 11249
11272 } } // namespace v8::internal 11250 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698